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
Int color = Color.GRAY;
// or int color = Color.argb(123,255,0,5);
// or int color = 0xaaff000;
in XML /res/values/color.xml
#ff0000
Java Code
int color = ContextCompat.getColor(context, R.color.colorRed);
GradientDrawable drawableBg = yourView.getBackground().mutate();
drawableBg.setColor(color);