In the string.xml file i use the following tag
\"#0000ff\"
If I use
textview
I am basically just merging all the partially good answers.
You defined your color as a String
, but AFAIK Android processes colors as Itegers
.
So use the Colors.xml
file (instead of strings.xml
):
and refer to it in code as R.color.CodeColor
.
(Moreover, I think, there is some naming convention that tells you to name these values all lowercase: code_color
or codecolor
)
Or you can define them as strings, but then you are need to make it an Integer: Color.parseColor(R.string.code_color)
.