I\'m working on an android application, and I have a drawable that I\'m loading up from a source image. On this image, I\'d like to convert all of the white pixels to a dif
Too late but in case someone need it:
fun setDrawableColor(drawable: Drawable, color: Int) :Drawable {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
drawable.colorFilter = BlendModeColorFilter(color, BlendMode.SRC_ATOP)
return drawable
} else {
drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
return drawable
}
}