/**
* 加载圆角图片。并且充满屏幕
*/
fun loadCropImageRadius(iv: ImageView, bkgColor: String?, radius: Int, path: String) {
val bitMap = ViewTool.createBmp4Rgb(bkgColor)
val placeholderDrawable = BitmapDrawable(iv.resources, bitMap)
// 设置 Glide 请求选项
var requestOptions = RequestOptions()
requestOptions =
requestOptions.transform(CenterCrop(), RoundedCorners(ScreenUtil.dp2px(radius)))
Glide.with(iv).load(path).placeholder(placeholderDrawable).apply(requestOptions).into(iv)
}
标签:圆角,bkgColor,Glide,iv,val,radius,CenterCrop,requestOptions
From: https://blog.51cto.com/u_14523369/6183204