How to change shape color dynamically?

You could modify it simply like this

GradientDrawable bgShape = (GradientDrawable)btn.getBackground();
bgShape.setColor(Color.BLACK);

Leave a Comment