I\'m trying to implement a simple colorfilter on an imageview to turn the black image into a white image. In order to achieve that I do the following:
we
We use this code
Drawable drawable = DrawableCompat.wrap(getDrawable(drawableResource));
drawable.mutate();
DrawableCompat.setTint(drawable, getColor(color));
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
public static int getColor(int id) {
return ContextCompat.getColor(getInstance().context, id);
}
public static Drawable getDrawable(int id) {
return ContextCompat.getDrawable(getInstance().context, id);
}