ImageLoader的工具类
来源:互联网 发布:淘宝客如何做免单活动 编辑:程序博客网 时间:2024/06/07 03:15
public class ImageUtils { /** * 对ImageLoader进行初使化 * @param context */ public static void initImageLoader(Context context){ File cacheFile = context.getExternalCacheDir(); ImageLoaderConfiguration configuration=new ImageLoaderConfiguration.Builder(context) .memoryCacheExtraOptions(480, 800)//缓存图片最大的长和宽 .threadPoolSize(2)//线程池的数量 .threadPriority(4) .memoryCacheSize(2*1024*1024)//设置内存缓存区大小 .diskCacheSize(20*1024*1024)//设置sd卡缓存区大小 .diskCache(new UnlimitedDiscCache(cacheFile))//自定义缓存目录 .writeDebugLogs()//打印日志内容 .diskCacheFileNameGenerator(new Md5FileNameGenerator())//给缓存的文件名进行md5加密处理 .build(); ImageLoader.getInstance().init(configuration); } /** * 得到图片的显示设置类 * @return */ public static DisplayImageOptions getImageOptions(){ DisplayImageOptions options=new DisplayImageOptions.Builder() .cacheInMemory(true)//使用内存缓存 .cacheOnDisk(true)//使用磁盘缓存 .bitmapConfig(Bitmap .Config.RGB_565)//设置图片的色彩模式 .imageScaleType(ImageScaleType.EXACTLY)//设置图片的缩放方式 .build(); return options; }}
MyApplication里面的写的
public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); //进行初使化 ImageUtils.initImageLoader(this); }}使用时//使用ImageLoader下载图片ImageLoader.getInstance().displayImage(path, imageView, ImageUtils.getImageOptions());
阅读全文
0 0
- ImageLoader的工具类
- ImageLoader的工具类
- ImageLoader的一个工具类
- ImageLoader的加载工具类
- 最简单的ImageLoader工具类
- ImageLoader的工具类(总结)
- ImageLoader加载本地图片的工具类
- ImageLoader加载图片的工具类
- 工具类—ImageLoader的配置
- ImageLoader工具类
- ImageLoader工具类
- ImageLoader工具类
- ImageLoader工具类封装
- ImageLoader工具类
- ImageLoader工具类
- ImageLoader工具类
- imageloader工具类
- Imageloader工具类
- 第三方登录
- 获取mnist训练数据集input_data.py
- EMMC 坏块
- 多项式计算//线性表练习
- Qt各种采样率录音 录音到内存
- ImageLoader的工具类
- ajax 中的contentType
- 冒泡排序(Bubble Sort),是一种计算机科学领域的较简单的排序算法。 它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要
- 求割点
- 数据结构线性表顺序结构的定义与实现C语言
- [SDS阅读理解/0]前言
- 04java基础之异常,泛型
- es6 多个模块export import
- Pyhton 3 学习笔记 2017.11.18