In my app I have to change all the colors runtime. The app is grey to begin with, and then asks the user to select their gender. When they select male then the app turns blue, and when they select female the app turns pink.
I have defined an AppTheme
that styles all widgets, referring to colors in res/values/colors.xml
and using res/drawable
for backgrounds, which in turn also refer to the colors. All is seems pretty solid and neatly tied together, so I'd really like to reuse this!
I image that if I somehow replace the res/values/colors.xml
, then everything would turn out fine, but I fear this is not possible and I don't know how to do this in the first place. I'm afraid I'd have to copy and paste my entire theme to AppTheme.Blue
and AppTheme.Pink
but that's quite horrible because that cascades into replacing close to every single drawable/*
.
So how to do this? There has to be some trick where I can have separate colors.xml
and switch between them...