如何使用通用图像装载机 [英] How to use Universal Image Loader
问题描述
我有一个要求,我需要加载的缩略图和文本
在的ListView
它获取由自定义设置适配器
。缩略图应存放在高速缓冲存储器,对于我使用的通用图像装载机但是我pretty的很多困惑在它的实施,以及如何使用它按我的要求,在加载图像的ListView
从网址
。请给我建议某些方面它具有良好的实施。
I have a requirement where I need to load thumbnails and a Text
in ListView
which gets set by the custom Adapter
. The Thumbnails should be stored in a cache memory, for that I am using the Universal Image Loader however I am pretty much confused in the implementation of it and how to use it as per my requirement in to load the images in ListView
from URL
. Please suggest me some ways for it with good implementation.
推荐答案
下面写下code线到你的适配器的getView()方法,在这里imageUrls [位置]是图片的URL阵列和holder.image是ImageView的。
Write below code line into your adapter's getView() method, here imageUrls[position] is array of Image Urls and holder.image is imageview.
imageLoader.displayImage(imageUrls[position], holder.image, null);
和下面写code线到您的适配器的构造。
And write below code line into your adapter constructor.
ImageLoader imageLoader=new ImageLoader(activity.getApplicationContext());
这本书能解决你的问题,如果你有任何关于这则告诉我,如有任何疑问。
it will solve your problem, And if you have any query regarding that then tell me.
和见下面链接的通用图像装载机为例完整的源$ C $ C。
And see below link for complete source code of Universal Image Loader Example.
这篇关于如何使用通用图像装载机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!