BaseAdapter适配器view缓存
来源:互联网 发布:凸优化求解算法 编辑:程序博客网 时间:2024/06/02 06:05
public View getView(int position, View convertView, ViewGroup parent) {final ContentData data = activity.getCommonalityInfo().getRecommendData().getDatas().get(position);HashMap<String, View> tag;if (convertView == null || (tag = (HashMap<String, View>) convertView.getTag()) == null) {convertView = View.inflate(activity, R.layout.dialog_item_video_about, null);tag = new HashMap<String, View>();tag.put("image", convertView.findViewById(R.id.iv_icon));tag.put("title", convertView.findViewById(R.id.tv_title));tag.put("timeLength", convertView.findViewById(R.id.tv_timeLength));convertView.setTag(tag);}// 防止重复加载itemif (parent.getHeight() != 0) {final ImageView image = (ImageView) tag.get("image");String imgUrl = Public.addParamsToImageUrl(data.getHorizontalPic(), Public.dip2px(activity, 100), Public.dip2px(activity, 75));image.setTag(imgUrl);Bitmap bitmap = activity.getAsyncImage().loadImage(imgUrl, new ImageCallback() {@Overridepublic void imageLoaded(Bitmap bitmap, String imageUrl) {if (busy) {return;}if (bitmap != null) {if (imageUrl.equals(image.getTag().toString()))image.setImageBitmap(bitmap);}}});if (bitmap != null)image.setImageBitmap(bitmap);elseimage.setImageResource(R.drawable.nodata);((TextView) tag.get("title")).setText(data.getName());String timeLength = "";if (null != data.getDuration()) {timeLength = QLStringUtils.generateTime(1000 * Integer.parseInt(data.getDuration()));;}((TextView) tag.get("timeLength")).setText("时长:" + timeLength);}return convertView;}
0 0
- BaseAdapter适配器view缓存
- baseadapter适配器
- BaseAdapter适配器
- baseAdapter适配器
- BaseAdapter适配器
- 万能的适配器 BaseAdapter
- Android自定义适配器BaseAdapter
- Android适配器之BaseAdapter
- Android 适配器BaseAdapter详解
- BaseAdapter 作为 ListView 适配器
- Android适配器BaseAdapter详解
- android 自定义适配器BaseAdapter
- 数据适配器BaseAdapter
- ListView适配器BaseAdapter
- 数据适配器 BaseAdapter
- 开发工具,适配器BaseAdapter
- BaseAdapter适配器实例介绍
- Android适配器之BaseAdapter
- C Primer Plus(第五版)中文版的问题
- 使用Gradle构建Android应用的渠道包
- SpringMVC常用注解,返回方式,路径匹配形式,验证
- java生成文件的默认保存路径与System.getProperty("user.dir")
- 获取Android设备电池电量状态
- BaseAdapter适配器view缓存
- 使用友盟分享,出现linker command failed with exit code 1
- JavaScript基础——面向对象的程序设计
- Go 语言项目管理
- 操作系统7- shell
- oto餐饮app实时订单物流追踪系统架构设计(一)
- C++学习第二课
- “undefined JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析
- zoj 1395 可行遍性问题