I want to edit the fill Color of a vector-file in Android programmatically.
In the xml-file I can set my color with the attribute android:fillColor
If you want to change the whole color, you could apply a PorterduffColorFilter.
But this does not work for a single
. Only for the whole drawable.
public void applyThemeToDrawable(Drawable image) {
if (image != null) {
PorterDuffColorFilter porterDuffColorFilter = new PorterDuffColorFilter(Color.BLUE,
PorterDuff.Mode.SRC_ATOP);
image.setColorFilter(porterDuffColorFilter);
}
}
VectorDrawable extends the Drawable class. See Docs