一、Glide加载圆形头像
效果

R.mipmap.head_icon是默认圆形头像
ImageView mImage = findViewById(R.id.image);
RequestOptions options = new RequestOptions()
.placeholder(R.mipmap.head_icon)
.circleCropTransform();
Glide.with(this)
.load("图像Uri")
.apply(options)
.into(mImage);
二、Glide给图像设置圆角
例子:设置图片圆角为10dp
效果

RequestOptions options = new RequestOptions()
.placeholder(R.drawable.capture_default)
.bitmapTransform(new RoundedCorners(dip2px(mContext, 10)));
Glide.with(this)
.load("图像Uri")
.apply(options)
.into(mImage);
单位转换方法
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
public static int px2dip(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}







![2023年中国婴童护肤发展概况及趋势分析:婴童功能护肤产品成为新趋势[图]](https://img-blog.csdnimg.cn/img_convert/3b7b9115267986f9c12b3343ffb0c894.png)











