ListView提高效率

  • 为每一项写一个xml布局文件
  • 写内部类继承BaseAdapter
  • 重写方法,其中:

Android高级控件(BaseAdapter)

  • 给ListView组件setAdapter我们写的适配器对象 

问题:①每次调用都要解析xml文件,消耗内存 ②每次调用都要查找findViewById

使用convertView:当convertView为空时才解析

Android高级控件(BaseAdapter)


使用持有者模式:
 

Android高级控件(BaseAdapter)

Android高级控件(BaseAdapter)

 

相关文章:

  • 2021-09-20
  • 2021-08-22
  • 2021-07-09
  • 2021-10-25
  • 2021-10-17
  • 2022-12-23
  • 2021-06-04
  • 2022-02-10
猜你喜欢
  • 2021-04-15
  • 2021-05-27
  • 2022-12-23
  • 2021-09-03
  • 2021-08-05
  • 2021-12-15
  • 2022-12-23
相关资源
相似解决方案