android代码修改图片颜色

来自https://www.jianshu.com/p/514fbcd7e98d

1432234-141985e0c335ef89.png
imageView.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
    }

你可能感兴趣的:(android代码修改图片颜色)