加载从标清图像到ListView中时提高效率的ListView [英] Improve ListView efficiency when loading images from SD into the ListView

查看:88
本文介绍了加载从标清图像到ListView中时提高效率的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是自定义适配器为我的ListView按照由罗曼盖伊高效的适配器样品。

I am using a custom adapter for my ListView as per the efficient adapter sample by Romain Guy.

在我的适配器,我用下面的code分配一个ImageView的一幅JPG格式存储到SD的getView()方法:

In the getView() method of my adapter I am assigning an ImageView a jpg image stored on SD using the following code :

File f=new File(MovieThumbs.get(position));

if(f.length() > 0) {
    holder.thumb.setImageBitmap(BitmapFactory.decodeFile(MovieThumbs.get(position)));
}

在通过使用这种方法从坏口吃应用程序遭受,因为它试图处理图像约200项的列表弹。

When flicking through a list of some 200 items using this method the app suffers from bad stuttering as it tries dealing with the images.

有没有更有效的解决方案呢?

Is there a more efficient solution for this?

推荐答案

图片需要在后台线程处理。需要回收的观点来加以考虑。我试图解决所有这些问题,我的样本code,现在工作得很好,你可以看看<一href="http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview/3068012#3068012">http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview/3068012#3068012

Images need to be processed in background thread. Recycled views need to be taken into account. I try to address all these issues in my sample code, it works fine now, you may take a look http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview/3068012#3068012

这篇关于加载从标清图像到ListView中时提高效率的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆