android layout - Divide the screen in to three different sizes -


in application screen, there 2 listviews l1(filled data d1) , l2(filled data d2)and 1 button @ bottom of screen.

conditions display lists:

if(show d1){    //display l1 list in middle of screen , button @ bottom of screen.   //hide l2  } if(show d2){    //display l2 list in middle of screen , button @ bottom of screen.   //hide l1  }  if(show d1 && d2){      if(d1>=d2){          //display l1 , l2 lists in middle of screen ,          //button @ bottom of screen.      }else if(d1<d2){          //display l1 , l2 lists in middle of screen ,          //button @ bottom of screen.      } } 

by using below layout, shows correctly while displaying both list @ time. when showing l1, covers whole screen , overlaps button , when showing l2, when data few displays correctly button come upward below list instead of bottom of screen. layout.xml:

<linearlayout    xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     android:background="@drawable/background_main"      >    <linearlayout        android:id="@+id/layout1"       android:layout_weight="1"        android:layout_height="wrap_content"        android:layout_width="fill_parent"       android:orientation="vertical">        <textview             android:id="@+id/txtsubheadingw"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:paddingbottom="5dp"             android:layout_margintop="2dp"             android:paddingleft="18dp"             android:gravity="center"             android:maxlines="1"             android:text="@string/lbl1"             android:textcolor="@color/blueviolet"             android:textstyle="bold" style="@style/style_text"             />       <listview         android:id="@+id/l1"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:layout_margin="5dp"             android:cachecolorhint="#00000000"         />       </linearlayout>    <linearlayout android:id="@+id/layout2"        android:layout_weight="1"        android:layout_height="fill_parent"        android:layout_width="wrap_content"       android:orientation="vertical">        <textview             android:id="@+id/txtsubheadingt"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:paddingbottom="5dp"             android:paddingleft="18dp"             android:gravity="center"             android:maxlines="1"             android:text="@string/lbl2"             android:textcolor="@color/blueviolet"             android:textstyle="bold"              android:visibility="gone" style="@style/style_text"              />         <listview         android:id="@+id/l2"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:layout_margin="5dp"             android:cachecolorhint="#00000000"        />     </linearlayout>     <linearlayout         android:id="@+id/lnrcontrols"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_margin="2dip"         android:background="@drawable/top_portrait"         android:gravity="center"         android:orientation="horizontal"         android:padding="3dip"          >          <button             android:id="@+id/btnok"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:background="@drawable/selector_text_selector"             android:text="@string/lbl_ok"             android:gravity="center"             android:textcolor="@color/white"            android:layout_gravity="center" style="@style/style_text"            />            </linearlayout>  </linearlayout> 


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -