in android app, pop dialog showing listview. problem having getting textview height fill parent. want fill parent , center text vertically. instead, appears wrap height. here xml dialog:
<?xml version="1.0" encoding="utf-8"?> <viewswitcher xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/loadswitcher" android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ff484a4a" android:gravity="center" android:orientation="vertical" android:tag="loadingview" > <linearlayout android:layout_width="fill_parent" android:layout_height="50dp" android:gravity="center" > <progressbar android:id="@+id/marker_progress" style="?android:attr/progressbarstyle" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginbottom="10dp" android:layout_margintop="10dp" android:indeterminate="true" /> </linearlayout> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/msg_pleasewait" android:textsize="18sp" /> </linearlayout> <linearlayout android:id="@+id/llcontent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:tag="contentview" > <textview android:id="@+id/tvheader" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginbottom="2dp" android:background="#7395bf" android:padding="3dp" android:text="@string/lbl_selectlocationset" android:textcolor="#ffffff" android:textsize="18sp" /> <listview android:id="@+id/lvdata" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minheight="50dp" android:background="#ff626262" android:cachecolorhint="#00000000" android:divider="#ff7f7f7f" android:dividerheight="1dp" android:scrollingcache="true" /> <linearlayout android:id="@+id/lltoolbar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#cacaca" android:orientation="horizontal" android:paddingleft="5dp" android:paddingright="5dp" android:paddingtop="5dp" > <button android:id="@+id/btnok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/lbl_buttonok" android:textsize="16sp" /> <button android:id="@+id/btncancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/lbl_buttoncancel" android:textsize="16sp" /> </linearlayout> </linearlayout> </viewswitcher>
and here xml row in listview:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <radiobutton android:id="@+id/rbselected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:checked="false" android:clickable="false" android:paddingleft="5dp" > </radiobutton> <imageview android:id="@+id/ivencrypted" android:layout_width="16dp" android:layout_height="16dp" android:layout_marginright="6dp" android:layout_toleftof="@id/rbselected" android:scaletype="fitxy" android:src="@drawable/icon_lock_16x16" /> <textview android:id="@+id/tvdate" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:background="#baf5c7" android:layout_alignparentleft="true" android:layout_marginright="10dp" android:layout_toleftof="@id/ivencrypted" android:textcolor="#ffffff" android:textsize="18sp" /> </relativelayout>
to textview fill parent, found placing in linearlayout , setting layout_centervertical true job. relativelayouts have problem fill_parent. thought problem dialogs in fact occur activities well.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <radiobutton android:id="@+id/rbselected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:checked="false" android:clickable="false" android:focusable="false" android:paddingleft="5dp" > </radiobutton> <imageview android:id="@+id/ivencrypted" android:layout_width="16dp" android:layout_height="16dp" android:layout_marginright="6dp" android:layout_centervertical="true" android:layout_toleftof="@id/rbselected" android:scaletype="fitxy" android:src="@drawable/icon_lock_16x16" /> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_centervertical="true" android:layout_toleftof="@id/ivencrypted" > <textview android:id="@+id/tvdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginright="10dp" android:layout_marginleft="5dp" android:gravity="center_vertical" android:textcolor="#000000" android:textsize="18sp" /> </linearlayout> </relativelayout>
Comments
Post a Comment