1

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

3
  • 3
    Why from strings and not from colors.xml, which is intended for this ? Commented Nov 16, 2012 at 6:43
  • 1
    I don't think that's possible, you can use @color/whiteColor. Commented Nov 16, 2012 at 6:43
  • 1
    Possible duplicate Using @string resource inside a style definition. Commented Nov 16, 2012 at 6:46

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.