2

I'm working on a live event app for a client. There are about 20 view containers that make heavy use of colorPrimary and colorAccent for coloring the views.

The client has just now decided that those colors should be different for each event.


Is there any way for me to use ContextThemeWrapper to simply inject the colorAccent and colorPrimary received from the backend? That way, when I start EventActivity, I can just put in the correct colors, and those would propagate all the way down to the activity's View, Fragment, and Dialog children.


If that's not possible, I guess I will have to go through each View one by one in Java and set the appropriate colors. That's tedious but easy. What's not easy are my shapes defined in XML. For instance, I have a drawable that I use as a button background which is simply a 1dp stroke on a rectangle with rounded corners. The color of the stroke is colorAccent. How would I go about changing that at runtime?

zholmes1
  • 539
  • 5
  • 21

0 Answers0