android - wrap_content for a listview's width -
is there way have listview with equal longest row? setting wrap_content listview 's width has no effect. listview covers whole screen horizontally.
this activity layout
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <listview android:id="@+id/listview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/country_picker_bg" />
and row xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" android:layout_marginbottom="@dimen/padding" android:padding="@dimen/padding" android:background="@drawable/white_round_rect" > <textview android:id="@+id/title" style="@style/greytextview" android:layout_marginleft="@dimen/padding"/> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/orange_arrow_selector"/> </linearlayout>
thank you, gratzi
is there way have listview with equal longest row?
no, in part because have no way know longest row is.
let's attach listadapter
listview
, getcount()
on listadapter
returns value of 1,234,567
. determine width of longest row, have create each row , examine width. take hours, , user not happy during hours.
Comments
Post a Comment