Android的ViewPager:从下载网址图像 [英] Android ViewPager: downloading the images from URL
问题描述
我试图创建使用 ViewPager
A图像画廊。我找到了几个例子,我已经得到了他们的所有工作。一件事的例子中没有显示,是如何使用下载的图像从URL来填充ViewPager。所有的教程要么在可绘制
文件夹或SD卡上的图像。有谁知道一个ViewPager从URL中获取图像的例子。我发现载入GridView和一个ListView懒惰的例子,但我不是足够聪明,能够将这些转化成工作ViewPager。我公司主要经营与适配器类的问题。延迟加载的例子似乎使用 BaseAdapter
,我认为一个ViewPager需要使用 PagerAdapter
吧?因此,在那里,从URL中获取的图像ViewPager的任何实例我需要什么ViewPager做的是从一个字符串数组像这样下载图片:
I'm trying to create a image Gallery using ViewPager
. I've found several examples and I've got them all to work. The one thing the examples don't show, is how to populate the ViewPager using downloaded images from an URL. All the tutorials either have the images in the Drawables
folder or on the SD card. Does anyone know of an example where a ViewPager gets the images from a URL. I've found examples of Lazy Loading a GridView and a ListView, but I'm not smart enough to be able to convert those into a working ViewPager. I mainly run into issues with the Adapter classes. The Lazy Loading examples seem to use BaseAdapter
and I think a ViewPager needs to use PagerAdapter
right? So, are there any examples of a ViewPager that gets the images from a URL? What I need the ViewPager to do is to download the images from a String Array something like this:
String[] imageGalleryStr = {
"http://www.website.com/images/image01.png",
"http://www.website.com/images/image02.png",
"http://www.website.com/images/image03.png",
"http://www.website.com/images/image04.png",
"http://www.website.com/images/image25.png",
"http://www.website.com/images/image26.png",
"http://www.website.com/images/image27.png",
"http://www.website.com/images/image28.png" };
任何想法?
推荐答案
使用这个库用于图像galary的 https://github.com/nostra13/Android-Universal-Image-Loader
use this library for image galary https://github.com/nostra13/Android-Universal-Image-Loader
这篇关于Android的ViewPager:从下载网址图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!