Issue
I have some colours which are reused in several different parts of my Android UI design. I am declaring the colours as resources in colors.xml
with meaningful names:
<color name="action_bar_background">#1a404f</color>
<color name="edit_heading_background">#1a404f</color>
When I have multiple different definitions for the same colour value (as in the above example), is there a way of specifying the actual value of #1a404f
just once? Or do I have to move away from naming the colours semantically, and give them names like dark_blue
instead?
Solution
You can define one colour in terms of another, like this:
<color name="dark_blue">#1a404f</color>
<color name="action_bar_background">@color/dark_blue</color>
<color name="edit_heading_background">@color/dark_blue</color>
Answered By - Graham Borland
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.