malik M
malik M

Reputation: 333

Can I read a string from string.xml file for text color?

I want to read a text color from string file for my style right now I am doing

<style name="xxx" >
    <item name="android:textColor">#ffffff</item>
</style>

I want to do

<style name="xxx" >
    <item name="android:textColor">@string/whiteColor</item>
</style>

want to read text color value from string file

Thanks in advance

Upvotes: 1

Views: 318

Answers (1)

Abx
Abx

Reputation: 2882

I think you can do it, try this

<string name="grey">@color/col</string>
<color name="col">#ffffff</color>

Now you can use the string grey instead of col to add the color OR

 <string name="grey">#ffffff</string>
    <color name="col">@string/grey</color>

Upvotes: 1

Related Questions