我正在使用列表视图来显示数据,在列表视图中我在每个列表项中使用图像。
从包装类调用以下方法
public View getView(int position, View convertView,
ViewGroup parent) { // implementation }
我正在关注本教程 http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List4.html
class DownloadImage extends AsyncTask<Void, Void, Drawable>{
@Override
protected Drawable doInBackground(Void... params) {
return Util.getImageFromURL(imageURL);
}
@Override
protected void onPostExecute( Drawable d ) {
getImageIcon().setImageDrawable(d);
}
}
new DownloadImage().execute();
上面的代码为每个 listItem 执行延迟图像上传。
问题是在加载第一张图像后,图像彼此重叠......知道为什么会这样吗?