listView优化
来源:互联网 发布:js urldecode解码 编辑:程序博客网 时间:2024/06/07 04:48
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if(convertView==null){
convertView = View.inflate(context, R.layout.item_lv_toutiao, null);
holder = new ViewHolder();
holder.iv_toutiao_pic = (ImageView) convertView.findViewById(R.id.iv_toutiao_pic);
holder.tv_toutiao_title = (TextView) convertView.findViewById(R.id.tv_toutiao_title);
holder.tv_toutiao_intro = (TextView) convertView.findViewById(R.id.tv_toutiao_intro);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
DisplayImageOptions options = ImageLoadUtils.initOptions();
ImageLoader.getInstance().displayImage(list.get(position).pic, holder.iv_toutiao_pic, options);
holder.iv_toutiao_pic.setScaleType(ImageView.ScaleType.FIT_XY);
holder.tv_toutiao_title.setText(list.get(position).title);
holder.tv_toutiao_intro.setText(list.get(position).intro);
return convertView;
}
class ViewHolder{
ImageView iv_toutiao_pic;
TextView tv_toutiao_title;
TextView tv_toutiao_intro;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if(convertView==null){
convertView = View.inflate(context, R.layout.item_lv_toutiao, null);
holder = new ViewHolder();
holder.iv_toutiao_pic = (ImageView) convertView.findViewById(R.id.iv_toutiao_pic);
holder.tv_toutiao_title = (TextView) convertView.findViewById(R.id.tv_toutiao_title);
holder.tv_toutiao_intro = (TextView) convertView.findViewById(R.id.tv_toutiao_intro);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
DisplayImageOptions options = ImageLoadUtils.initOptions();
ImageLoader.getInstance().displayImage(list.get(position).pic, holder.iv_toutiao_pic, options);
holder.iv_toutiao_pic.setScaleType(ImageView.ScaleType.FIT_XY);
holder.tv_toutiao_title.setText(list.get(position).title);
holder.tv_toutiao_intro.setText(list.get(position).intro);
return convertView;
}
class ViewHolder{
ImageView iv_toutiao_pic;
TextView tv_toutiao_title;
TextView tv_toutiao_intro;
}
1 0
- ListView优化
- listView优化
- ListView优化
- ListView优化
- ListView优化
- ListView优化
- listView优化
- listview 优化
- ListView优化
- listView优化
- ListView 优化
- ListVIew优化
- ListView优化
- ListView优化
- listview优化
- Listview 优化
- ListView优化
- ListView 优化
- poj 2559
- KMP算法总结
- 依赖注入?Dagger?
- LeetCode:Longest Valid Parentheses
- HBase体系架构
- listView优化
- 顺序表应用4:元素位置互换之逆置算法
- 使用Java API 操作Hbase表出现异常:Exception in thread "main" java.lang.NoClassDefFoundError
- JNI 错误: 无法访问android.app.Activity
- Hadoop学习笔记(7)-简述MapReduce计算框架原理
- 基于ZigBee和STM32的智能家居控制系统的设计与实现(四)
- Python学习备忘3
- Qt模仿360系统托盘
- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path