android - wrap_content doesn't work on list view -
when set property: android:layout_height of listview wrap_content wrap first item in listview:
... <listview android:id="@+id/points_add_list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/points_add_progress"/> <imageview android:id="@+id/points_add_progress2" android:layout_width="fill_parent" android:layout_height="2dp" android:layout_below="@id/points_add_list" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:src="@android:color/darker_gray"/> </relativelayout> </scrollview>
if use example 300dp instead of wrap_content, other items visible.
my custom view layout xml list view adapter:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <textview android:id="@+id/points_add_row_title" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" style="@style/planetext"/> <radiobutton android:id="@+id/points_add_row_radio" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </linearlayout>
i want add little comment, reputation isn't enough to. , opinion wrong.
karakuri's answer on commonsware's links right answer think. , google guy said why shouldn't use wrap_content on listview. http://www.youtube.com/watch?v=wdbm6wveo70&t=40m40s
and comment, opinion that,
scrollview's height wrap_content scroll vertically. if then, scrollview's height adapter's height or imageview's height. bcuz, scrollview doesn't care how many listitem should displayed. check how many view or groupview exist inside of itself.
and recommend don't use listview inside of scrollview (or opposite). because, both view have check touch-move event scroll view. if mix it, android can't decide view should scrolled, if both view have same scrolling-way.
Comments
Post a Comment