I am developing an application that will be themed with different colors and images for different clients. While I have the option to re-write the colors.xml file with the custom colors at build time, I am leaning towards setting up the colors at runtime. What I am wondering is if that is some way to programmatically change the value of a color defined in the colors.xml file and have that new value take effect in ALL places where it is used in the layout definition.
So in other words if I have:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color headerColor="white">#FFF</color>
<color backgroundColor="black">#000</color>
</resources>
And a layout file with something like:
<TextView
android:id="@+id/listItemHeaderActivity"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textColor="@color/headerColor"
android:background="@color/backgroundColor"
android:text="@string/listTextHeaderActivity"/>
Can I change the value of headercolor
and backgroundColor
in Java and have it take place in all Views that use those values? Or will I have to change each relevant View color individually whenever I display those views?
Thanks in advance.