Android ListView 第一次设置Adapter时候getView调用多次
2015-04-13 10:57
507 查看
之前遇到这个奇怪现象,记录一下:
使用Listview并设置Adapter时, 会回调多次getView,比如我有4个items,按理说getView应该是调用一次(打出4个log),结果回调有4次(4*4个log)。
原因:
Listview的layout_height 为自适应:wrap_content,这个情况下,listview没办法确定用多少item的view来填充它自己,这迫使listview多次测量它的子元素。
解决:
[html] view plaincopy
android:layout_height="match_parent"
http://blog.csdn.net/wyzxk888/article/details/15335857
使用Listview并设置Adapter时, 会回调多次getView,比如我有4个items,按理说getView应该是调用一次(打出4个log),结果回调有4次(4*4个log)。
原因:
Listview的layout_height 为自适应:wrap_content,这个情况下,listview没办法确定用多少item的view来填充它自己,这迫使listview多次测量它的子元素。
解决:
[html] view plaincopy
android:layout_height="match_parent"
http://blog.csdn.net/wyzxk888/article/details/15335857
相关文章推荐
- Android ListView 第一次设置Adapter时候getView调用多次
- ListView设置adapter时getView被多次调用
- Android 解决ListView、GridView在首次显示时adapter可能多次调用getView的问题
- Android中ListView多次调用getView
- android ListView 多次调用 getView方法
- android ListView 在初始化时多次调用getView()原因分析
- android ListView 在初始化时多次调用getView()原因分析
- android listview 连续调用 getview多次问题分析及解决
- android ListView 和Adapter 结合,但是不调用getView()方法??
- ListView的adapter中getView被多次调用的问题
- Android ListView等getView调用多次问题
- 解决adapter.getView()方法多次被调用,导致listView卡顿的原因。
- android:ListView滑动时图片重复加载,多次调用了GetView().
- Android listview&gridview getview 方法多次调用问题解决方法
- android——listview gridview getview调用多次
- android: BaseAdapter的getview方法会多次重复调用
- android Adapter 多次调用getview的position=0 position总是0
- listview中嵌套gridview时候,getview多次调用的bug
- Android中listview getview被多次调用
- android PullToRefreshListView(listview) baseadapter getview 循环调用