I have a Shape defined in xml. Now I need to change a solid color from the code, could you please advice how?
Shape
xml
solid color
I use this in my code
GradientDrawable myGrad = (GradientDrawable)rectangle.getBackground(); myGrad.setColor(Color.BLACK);
Hope this helps :)
EDIT: for GradientDrawable instead of ShapeDrawable
GradientDrawable
ShapeDrawable