列表视图中的图像加载过滤器 - Android

时间:2013-04-10 13:50:16

标签: android

我有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加载图像?没有闪烁?

0 个答案:

没有答案