作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在 ViewHolder pattern 中将 ViewHolder 设为静态对性能至关重要吗? ?
A ViewHolder object stores each of the component views inside the tag field of the Layout, so you can immediately access them without the need to look them up repeatedly. First, you need to create a class to hold your exact set of views. For example:
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).
关于android - 在 ViewHolder 模式中将 ViewHolder 设为静态对性能至关重要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12368302/
我是一名优秀的程序员,十分优秀!