Imageloader的默认加载图片或加载圆形图片的方法

这是默认的如果没有网的情况下加载什么样的图片
public static DisplayImageOptions getDefautOption() {

    DisplayImageOptions imageOptions = new DisplayImageOptions.Builder()
            .showImageForEmptyUri(R.mipmap.ic_launcher)
            .showImageOnFail(R.mipmap.ic_launcher)
            .showImageOnLoading(R.mipmap.ic_launcher)
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
            .resetViewBeforeLoading(true)//在加载之前复位一下显示
            .bitmapConfig(Bitmap.Config.RGB_565)//图片的质量
            .considerExifParams(true)///是否考虑JPEG图像EXIF参数(旋转,翻转)
            .build();
    return imageOptions;
}

这是默认的加载圆形的图片
/**
* 圆形图片的配置
* @return
*/
public static DisplayImageOptions getCircleOption() {
DisplayImageOptions imageOptions = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.mipmap.ic_launcher)
.showImageOnFail(R.mipmap.ic_launcher)
.showImageOnLoading(R.mipmap.ic_launcher)
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.resetViewBeforeLoading(true)//在加载之前复位一下显示
.bitmapConfig(Bitmap.Config.RGB_565)//图片的质量
.considerExifParams(true)///是否考虑JPEG图像EXIF参数(旋转,翻转)
.displayer(new CircleBitmapDisplayer())//圆形显示
.build();
return imageOptions;
}

这是加载圆角图片
/**
*
* @return
*/
public static DisplayImageOptions getBoundOption() {
DisplayImageOptions imageOptions = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.mipmap.ic_launcher)
.showImageOnFail(R.mipmap.ic_launcher)
.showImageOnLoading(R.mipmap.ic_launcher)
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.resetViewBeforeLoading(true)//在加载之前复位一下显示
.bitmapConfig(Bitmap.Config.RGB_565)//图片的质量
.considerExifParams(true)///是否考虑JPEG图像EXIF参数(旋转,翻转)
.displayer(new RoundedBitmapDisplayer(20))//指定加载圆角的大小
.build();
return imageOptions;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值