Storing hex color values in strings.xml
You need to create a set of styles in your xml (regularly in res/values/styles.xml)
<color name="gray">#eaeaea</color><color name="titlebackgroundcolor">#00abd7</color><color name="titlecolor">#666666</color>
In the layout files you can call to the colors or styles:
android:textColor="@color/titlecolor"
Checkout some examples:
For that you can do one thing: Define colors.xml inside the values folder and then add your color value with # as given below:
<?xml version="1.0" encoding="utf-8"?><resources> <color name="myColor">#000000</color></resources>
Then how do you refer this color value inside the application:
static:
android:textColor="@color/myColor"
Coding:
TextView1.setTextColor(R.color.myColor);