ListView的adapter中getView方法一直調用,listviewgetview
當ListView的高度不定(例如重寫ListView搞成可自動的擴充的ListView)或 ListView嵌套在SrollView(高度不定)中,listView中的一個item元素改變會使得全部item都調用getView()的方法。
這種 ok 一定要用LinearLayout套ListView(具體原因還不太清楚)
<ScrollView android:layout_width="match_parent" android:layout_height="400dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="400dp" > <ListView android:id="@+id/item_list" android:layout_width="match_parent" android:layout_height="400dp" /> </LinearLayout> </ScrollView>
這種就會一直調用getview
<ScrollView android:layout_width="match_parent" android:layout_height="400dp" > <RelativeLayout android:layout_width="match_parent" android:layout_height="400dp" > <ListView android:id="@+id/item_list" android:layout_width="match_parent" android:layout_height="400dp" /> </RelativeLayout> </ScrollView>
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。