1 android:scaleType=“fitXY”
2 设置圆角
public static void loadRoundImage(final Context context, final int cornerRadius, String url,int resId,final ImageView imageView){
Glide.with(context)
.load(url)
.asBitmap()
.placeholder(resId)
.diskCacheStrategy(DiskCacheStrategy.ALL) //设置缓存
.into(new BitmapImageViewTarget(imageView){
@Override
protected void setResource(Bitmap resource) {
super.setResource(resource);
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(context.getResources(), resource);
circularBitmapDrawable.setCornerRadius(cornerRadius); //设置圆角弧度
imageView.setImageDrawable(circularBitmapDrawable);
}
});
}