我有 getView 如下
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
LayoutInflater tempinflator = ((Activity)mContext).getLayoutInflater();
if (convertView == null) {
convertView = tempinflator.inflate(R.layout.event_list_item, null);
}
img = (ImageView)convertView.findViewById(R.id.businessLogo);
img.setImageResource(R.drawable.tour_default);
int loader = R.drawable.tour_default;
String image_url = event.getBusinessLogo();
ImageLoader imgLoader = new ImageLoader(mContext);
imgLoader.DisplayImage(image_url, loader, img);
return convertView;
}
image_url = 图片的互联网地址
和 ImageLoader 方法如下
public void DisplayImage(String url, int loader, ImageView imageView)
{
stub_id = loader;
imageViews.put(imageView, url);
Bitmap bitmap=memoryCache.get(url);
if(bitmap!=null)
imageView.setImageBitmap(bitmap);
else
{
queuePhoto(url, imageView);
imageView.setImageResource(loader);
}
}
我试图弄清楚为什么图像会闪烁。有没有办法在列表视图中从 URI 加载图像?没有闪烁?