在网格视图中图像加载缓慢

时间:2019-07-29 15:27:23

标签: java android

我正在使用Universal Image Loader从Firebase数据库的网格视图中加载图像。但是,加载时间太长。

我在UIL上使用了一些自定义配置。

public ImageLoaderConfiguration getConfig(){
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .showImageOnLoading(default_image)
            .showImageForEmptyUri(default_image)
            .showImageOnFail(default_image)
            .cacheInMemory(true)
            .imageScaleType(ImageScaleType.EXACTLY)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(mcontext)
            .defaultDisplayImageOptions(defaultOptions)
            .threadPoolSize(2)
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024).build();
    return configuration;

}

0 个答案:

没有答案