fun ImageView.loadPic(url: Int?) {
val options = RequestOptions().apply {
error(R.mipmap.ic_ban_100601)
placeholder(R.mipmap.ic_ban_100601)
}
if (url != null) Glide.with(context).load(url).apply(options).transform(
GranularRoundedCorners(
CommonUtil.dip2px(App.instance, 6f).toFloat(),
CommonUtil.dip2px(App.instance, 6f).toFloat(),
0f,
0f
)
)//实现左、右上角圆角
.into(this)
}
//调用
holder.getView<ImageView>(R.id.iv_header).loadPic(id)