将 ViewHolder 设置为静态对性能至关重要吗?ViewHolder模式 http://developer.android.com/training/improving-layouts/smooth-scrolling.html?
ViewHolder 对象存储标签内的每个组件视图
布局的字段,因此您可以立即访问它们,而无需
需要反复查找。首先,您需要创建一个类
坚持你的确切观点。例如:
static class ViewHolder {
TextView text;
TextView timestamp;
ImageView icon;
ProgressBar progress;
int position;
}
性能并不重要,重要的是使用。如果ViewHolder
类不是静态的 - 您必须提供父类的实例:
No enclosing instance of type Type is accessible.
Must qualify the allocation with an enclosing instance of type Type
(e.g. x.new A() where x is an instance of Type).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)