Eug*_*ene 13 performance android listview
在ViewHolder模式中将ViewHolder设置为静态对性能至关重要吗?
ViewHolder对象将每个组件视图存储在Layout的标记字段中,因此您可以立即访问它们而无需重复查找它们.首先,您需要创建一个类来保存您的确切视图集.例如:
static class ViewHolder {
TextView text;
TextView timestamp;
ImageView icon;
ProgressBar progress;
int position;
}
Run Code Online (Sandbox Code Playgroud)
它对于性能并不重要,它与使用有关.如果ViewHolderclass不是静态的 - 你必须提供父类的实例:
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).
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5004 次 |
| 最近记录: |