来自https://www.jianshu.com/p/514fbcd7e98d
1432234-141985e0c335ef89.pngimageView.setImageDrawable(tintDrawable(imageView.drawable, ColorStateList.valueOf(Color.argb(alpha, red, green, blue))))
fun tintDrawable(drawable: Drawable, colors: ColorStateList): Drawable {
val wrappedDrawable = DrawableCompat.wrap(drawable)
DrawableCompat.setTintList(wrappedDrawable, colors)
return wrappedDrawable
}
网友评论