I\'m trying to set some general colors for a program I\'m writing. I created a colors.xml file and am trying to directly reference the colors from the layout.xml file. I bel
You should write textcolor in xml as
android:textColor="@color/text_color"
or
android:textColor="#FFFFFF"
After experimenting on that case:
android:textColor="@colors/text_color"
is wrong since @color
is not filename dependant. You can name your resource file foobar.xml, it doesn't matter but if you have defined some colors in it you can access them using @color/some_color
.
Update:
file location: res/values/colors.xml The filename is arbitrary. The element's name will be used as the resource ID. (Source)
You have a typo in your xml; it should be:
android:textColor="@color/text_color"
that's "@color" without the 's'.
A variation using just standard color code:
android:textColor="#ff0000"