Paul A Jungwirth Paul A Jungwirth - 6 months ago 16
Android Question

Refer to color in built-in theme in my layout file

My Android application is using the Holo Light theme. In my layout I want to make sure I use the same color as the rest of the theme, like this:

<TextView xmlns:android=""

I can see that that color is defined here:

I've also tried
, but I get errors for all of them. How do I use the colors from a built-in theme?

I'm seeing errors like:

No resource found that matches the given name (at 'textColor' with value '@color/hint_foreground_light').
Resource is not public. (at 'textColor' with value '@android:color/hint_foreground_light').
No resource found that matches the given name (at 'textColor' with value '?textColorHint').

(The reason I'm even messing with setting
is because this
is for a
and is showing up as nearly-white-on-white by default.)


The color value you referenced is indeed private and is not meant to be accessed. However, you can access it using:


The IDE will show an error but since, its xml, it'll compile and will also work flawlessly. This method is not recommended as you never know when will those value change or become inaccessible.

It is recommended that you simply copy the required resource in your project and reference it from there.