如何在我的android应用程序中加载一堆图像

如何在我的android应用程序中加载一堆图像,android,Android,我正在尝试实现一个从服务器加载大量图像的应用程序(如Google images loading)。通过使用我可以实现的概念,我尝试了Google没有找到解决方案。请提前给我好的建议和任何示例或链接,谢谢。使用listview或gridview显示图像 展开自定义布局并在listview或gridview中显示图像 您可以使用Universal Image Loader从MediaStore或web加载图像。使用缓存。基于延迟加载,但具有更多配置选项 在您的适配器构造函数中 File cache

我正在尝试实现一个从服务器加载大量图像的应用程序(如Google images loading)。通过使用我可以实现的概念,我尝试了Google没有找到解决方案。请提前给我好的建议和任何示例或链接,谢谢。

使用listview或gridview显示图像

展开自定义布局并在listview或gridview中显示图像

您可以使用Universal Image Loader从MediaStore或web加载图像。使用缓存。基于延迟加载,但具有更多配置选项

在您的适配器构造函数中

 File cacheDir = StorageUtils.getOwnCacheDirectory(a, "UniversalImageLoader/Cache");


// Get singletone instance of ImageLoader
imageLoader = ImageLoader.getInstance();
// Create configuration for ImageLoader (all options are optional)
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(a)
          // You can pass your own memory cache implementation
         .discCache(new UnlimitedDiscCache(cacheDir)) // You can pass your own disc cache implementation
         .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
         .enableLogging()
         .build();

// Initialize ImageLoader with created configuration. Do it once.
imageLoader.init(config);
options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.stub_id)//dummy image
.cacheInMemory()
.cacheOnDisc()
.displayer(new RoundedBitmapDisplayer(20))
.build();
在getView()中

您也可以使用。还使用缓存

也可以在listview或grdiview中使用ViewHolder


对于无止境列表,您可以使用commonware无止境列表

搜索有关UniversalImagedownloader,Lazyloading的图像等。TQ Pragnani这是有用的。&对不起,我没有点向上投票4 u r Ans很高兴知道它对你有用。。。
  ImageView image=(ImageView)vi.findViewById(R.id.imageview); 
  imageLoader.displayImage(imageurl, image,options);