常用的ImageLoader配置

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        DisplayImageOptions options = new DisplayImageOptions.Builder().cacheOnDisk(true).cacheInMemory(true)
                .showImageOnLoading(R.drawable.chat_photo_album).showImageOnFail(R.drawable.chat_photo_album).build();
        int maxSize = (int) (Runtime.getRuntime().maxMemory() / 8);
        @SuppressWarnings("deprecation")
        ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(getApplicationContext())
                .discCache(new UnlimitedDiskCache(getCacheDir())).memoryCache(new UsingFreqLimitedMemoryCache(maxSize))
                .threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).defaultDisplayImageOptions(options).build();
        ImageLoader.getInstance().init(configuration);
    }
}

你可能感兴趣的:(ImageLoade)