ImageLoader工具类
来源:互联网 发布:练音准的软件 编辑:程序博客网 时间:2024/06/06 20:03
public class Imageto {
public static void initsta(Context context){
//默认路径
File cachefile = context.getExternalCacheDir();
//自定义的缓存路径
File cachefile=new File(Environment.getExternalStorageDirectory().getPath()+"/abc/a");
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(480, 800)//缓存图片最大的长和宽
.threadPoolSize(2)//线程池的数量
.threadPriority(4)
.memoryCacheSize(5*1024*1024)//设置内存缓存区大小
.diskCacheSize(20*1024*1024)//设置sd卡缓存区大小
.diskCache(new UnlimitedDiscCache(cachefile))//自定义磁盘缓存目录
.diskCacheFileNameGenerator(new Md5FileNameGenerator())//给缓存的文件名进行md5加密处理
.build();
ImageLoader.getInstance().init(configuration);
}
public static DisplayImageOptions getoptions(){
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true)//使用内存缓存
.cacheOnDisk(true)//使用磁盘缓存
.showImageOnLoading(R.mipmap.ic_launcher)//设置正在下载的图片
.showImageForEmptyUri(R.mipmap.ic_launcher)//url为空或请求的资源不存在时
.showImageOnFail(R.mipmap.ic_launcher)//下载失败时显示的图片
.bitmapConfig(Bitmap.Config.RGB_565)//设置图片格式
.displayer(new RoundedBitmapDisplayer(20))//设置圆角图片
.build();
return options;
}
}
阅读全文
0 0
- ImageLoader工具类
- ImageLoader工具类
- ImageLoader工具类
- ImageLoader工具类封装
- ImageLoader工具类
- ImageLoader工具类
- ImageLoader工具类
- imageloader工具类
- Imageloader工具类
- ImageLoader的工具类
- ImageLoader工具类
- ImageLoader的工具类
- ImageLoader工具类
- ImageLoader的一个工具类
- ImageLoader的加载工具类
- ImageLoader加载图片工具类
- 文章标题 ImageLoader工具类
- ImageLoader加载图片工具类
- 收入从0到50亿,为什么每个人都该学学销售管理?
- Ijkplayer最简单的简单使用
- 【头条】EMC:数字化转型,咨询先行
- 数据结构第十三周项目2--二叉树排序树中查找的路径
- [Unity3D]关于NaN(Not a Number)的问题
- ImageLoader工具类
- 关于IDEA无法引入包和类的情况
- IP数据报转发算法 or 路由器转发分组的过程
- 列表展示数据+点击进行断点续传
- 极大极小搜索
- reactjs中使用PubSub监听机制传参
- 关于Recyview的条目点击事件
- 【Unity开发】Unity2D多分辨率屏幕适配方案(IOS露出天空盒解决办法)
- Atom日常插件汇总