implementation 'com.github.bumptech.glide:glide:4.9.0'
public class GlideRoundImageUtils {
public static void setRoundImage(Context mContext, int corners, int size, String imageLoad, ImageView imageView) {
//设置图片圆角角度
RoundedCorners roundedCorners = new RoundedCorners(ConvertUtils.dp2px(corners));
//通过RequestOptions扩展功能,override:采样率,因为ImageView就这么大,可以压缩图片,降低内存消耗
RequestOptions options = new RequestOptions().override(ConvertUtils.dp2px(size))
.placeholder(R.mipmap.pic_def_bj)
.error(R.mipmap.pic_def_bj)
.fallback(R.mipmap.pic_def_bj);
Glide.with(mContext).load(imageLoad).apply(options).transform(new CenterCrop(), roundedCorners).into(imageView);
}
}
Glied设置圆角
最新推荐文章于 2021-09-28 14:29:51 发布