Android. Why does not work layout gravity when I define ListView's height programmatically? -


if define listview's height in xml layout gravity working, want calculate height programmatically, in case layouts sliding on 1 another.

the xml:

<edittext android:id="@+id/inputsearch"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:padding="10dp"     android:hint="search..."     android:background="@drawable/bar"     android:inputtype="text"    android:layout_gravity="top" />  <listview      android:id="@+id/contactlist"      android:layout_width="wrap_content"      android:layout_height="400dp"       android:layout_gravity="bottom" /> 

code:

typedvalue tv = new typedvalue();     if (gettheme().resolveattribute(android.r.attr.actionbarsize, tv, true))     {        actionbarheight = typedvalue.complextodimensionpixelsize(tv.data,getresources().getdisplaymetrics());     }  display display = getwindowmanager().getdefaultdisplay();  point size = new point();  display.getsize(size);  int layoutheight = size.y - 59 - actionbarheight;  listview.setlayoutparams(new framelayout.layoutparams(framelayout.layoutparams.wrap_content,layoutheight)); 

try this

    layoutparams params = listview.getlayoutparams();     params.height = layoutheight;     listview.setlayoutparams(params); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -