ImageLoader简单属性

来源:互联网 发布:2017前景行业知乎 编辑:程序博客网 时间:2024/06/08 12:23
@Overridepublic void onCreate() {    super.onCreate();
String path = Environment.getExternalStorageDirectory() + "/aaaa";File pathFile = new File(path);ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)        //指明内存缓存多少像素图片 480*800        .memoryCacheExtraOptions(480,800)        //指明线程的优先级        .threadPriority(100)        //配置多少个线程在后台加载图片        .threadPoolSize(3)        //指明图片sdcard缓存,缓存到什么地方        .diskCache(new UnlimitedDiskCache(pathFile))        //限定一下缓存的大小 在内存当中缓存2MB的大小图片        .memoryCacheSize(2*1024*1024)        //在sdcard缓存多少MB的图片        .diskCacheSize(50*1024*1024)        //指明图片文件名(MD5) 为了避免有重复的图片        .diskCacheFileNameGenerator(new Md5FileNameGenerator())        .build();ImageLoader.getInstance().init(config);
}public static DisplayImageOptions getOption(){ DisplayImageOptions options = new DisplayImageOptions.Builder() //正在加载时显示 .showImageOnLoading(R.mipmap.ic_launcher) //加载为空时显示 .showImageForEmptyUri(R.mipmap.ic_launcher) //正在加载时显示 .showImageOnFail(R.mipmap.ic_launcher) //圆角图片 .displayer(new RoundedBitmapDisplayer(360)) .build(); return options;}
原创粉丝点击