使用ImageLoaders
Glide
ImageView的ImageView的=(ImageView的)findViewById(R.id.my_image_view);
Glide.with(this).load("http://goo.gl/gEgYUd").into(imageView);
簡單圖像加載。檢查您可以與聽衆一起使用它們的鏈接。
你還可以嘗試:
picasso
Android-Universal-Image-Loader
編輯:作爲OP說,他使用UIL。
]您應該使用圖像感知。 你可以擁有自己的高緩存內存配置。
public void initializeImageLoader(final Context sContext) {
final ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(sContext)
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.taskExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
.taskExecutorForCachedImages(AsyncTask.THREAD_POOL_EXECUTOR)
.threadPoolSize(3) // default
.threadPriority(Thread.NORM_PRIORITY - 1) // default
.tasksProcessingOrder(QueueProcessingType.FIFO) // default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new UsingFreqLimitedMemoryCache(50 * 1024 * 1024)) // default
.memoryCacheSize(50 * 1024 * 1024)
.imageDownloader(new BaseImageDownloader(sContext)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.build();
ImageLoader.getInstance().init(config);
}
在獲取實例之前使用此初始化。
initializeImageLoader(context); ImageLoader imageLoader = ImageLoader.getInstance();
設置裝載機的選項。
final DisplayImageOptions options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.loading)
.showImageForEmptyUri(R.drawable.noimage)
.showImageOnFail(R.drawable.noimage)
.resetViewBeforeLoading(false) //default
.bitmapConfig(Bitmap.Config.RGB_565)
.cacheInMemory(true)
.cacheOnDisk(false) //default
.build();
並將其設置爲您的裝載機:
final ImageAware imageAware = new ImageViewAware(viewHolder.thumbnailImageView, false);
imageLoader.displayImage(imageUrl, imageAware, options);
使用圖像庫,如壁畫加載和緩存畫面,供各位 – Breavyn