baseAdapter 优化

public class ViewHolder {

  ImageView image = null;
  TextView title = null;
  TextView date = null;
}

 

getView(){

  if (convertView == null) {
    viewHolder = new ViewHolder();

    viewHolder.image=new ImageView(context);

    viewHolder.title = new TextView(context);

    viewHolder.date = new TextView(context);
    convertView.setTag(viewHolder);
  } else {
    viewHolder = (ViewHolder) convertView.getTag();
  }

}

在adapter中设置单击监听,性能怎么样不好说,但是单击事件触发会处理的更好

你可能感兴趣的:(BaseAdapter)