ListView的adapter中getView方法一直调用
当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>
posted on 2017-06-27 09:27 gavanwanggw 阅读(292) 评论(0) 编辑 收藏 举报