我有一个显示两列图像视图的网格视图。我正在使用异步任务加载这些图像(请参阅这篇文章Lazy load of images in ListView)
但是当我滚动 gridview 时,位置中的图像正在混合。例如第 14 张图像显示第 1 张图像,我认为视图试图在异步任务完成之前显示旧图像。
我的代码:
public Content getItem(int position) {
return contents.get(position);
}
public long getItemId(int position) {
return position;
}
@Override
public boolean hasStableIds() { return true; }
public View getView(int position, View convertView, ViewGroup parent) {
Thumbnail contentView;
Content current = contents.get(position);
if (convertView == null) {
contentView = new Thumbnail(mContext);
}
else {
contentView = (Thumbnail) convertView;
}
contentView.title = current.getTitle();
contentView.image = current.getImage();
contentView.link = current.getLink();
contentView.init();
return contentView;
}
初始化函数
TextView titleText = (TextView)super.findViewById(R.id.titleText);
titleText.setText(title);
ImageView imageControl = (ImageView)super.findViewById(R.id.thumbImage);
DrawableManager loadImage = new DrawableManager(); loadImage.fetchDrawableOnThread(imgUrl, imageControl);
等待您的帮助
谢谢