I'm facing a problem and i tried several ways to face it, still unsuccessful.
My app is using multiple themes like : Halloween, Chirstmas, etc and i'm using some colors attributes on widget like TabLayout background, Text Color, etc. to contextualized the app.
The question is : how do I use the same colors attributes with differentes values depending of a Theme context ?
So, basically here's the normal ways to declare colors :
<color name="mapMarkerSelectedTextColor">@android:color/white</color>
<color name="mapLoadingIndicatorColor">@color/white</color>
But, theme and colors are immutable so I thought, maybe I can override those colors inside each theme like :
<item name="mapMarkerUnselectedTextColor">@color/christmas_red</item>
<item name="mapMarkerSelectedTextColor">@color/white</item>
=> unsuccessful
Other lead, declare those colors as attributes :
<attr name="mapLoadingIndicatorColor" format="reference|color" />
<attr name="map_autocomplete_accent_color" format="reference|color" />
And use theme in my XML like this : "?attr/mapLoadingIndicatorColor
".
But this features is only allowed since Lollipop version and cause crashs before.
I've reading a lot about theme customisation, color overriding, but never found a clear solution about this situation.
Thanks anyway.