您的位置:首页 > 其它

viewHolder提升adaptor效率 ,ListView、BaseAdaptor总结

2014-02-25 18:00 435 查看
1.使用static 的ViewHolder 可以优化ListView性能近50%

2. OOM如果你的Item是自定义的Item的话,例如你的自定义Item布局ViewGroup中包含:按钮、图片、flash、CheckBox、
RadioButton等一系列你能想到的控件的话, 你要在getView中单单使用ViewHolder是远远不够的如果数据过多,加载的 图片过多过大,你BitmapFactory.decode的猛多的话,OOM!!!! ---出自http://mzh3344258.blog.51cto.com/1823534/889879


3、ListView中getView的原理与解决多轮重复调用的方法--- /article/2780474.html

4、RecycleBin
参看android源码:android.widget.AbsListView.RecycleBin


5.如果不设置listview为固定大小(fillparent、XXdp) 将会出现多次调用getView方法-----"Never set the
layout_height
and
layout_width
of
your listview to
wrap_content
as
getView()
will
force your adapter to get some child for measuring the height of the views to be drawn in list view and can cause some unexpected behaviour like returning convertview even the list is not scrolled.always use
match_parent
or
fixed width/height."







参考文章:eoe: Adapter中getView参数convertView问题 : http://www.eoeandroid.com/thread-319764-1-1.html
ViewHolder模式: http://blog.csdn.net/djcken/article/details/7658871
stackoverflow: http://stackoverflow.com/questions/11945563/how-listviews-recycling-mechanism-works
ListView recycleler机制详解:http://cmsbai.blog.51cto.com/330479/1184272
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: