Home » Android » What is the default color of ?attr/colorControlHighlight in android?

What is the default color of ?attr/colorControlHighlight in android?

Posted by: admin May 14, 2020 Leave a comment


I need to know the default color of ?attr/colorControlHighlight in android because I need to apply the same color for my buttons press state background in my drawable for pre lollipop devices. ?attr/colorControlHighlight is one of the attributes from lollipop that you can’t use on pre lollipop or else it would trigger an error.

How to&Answers:

?attr/colorControlHighlight is a reference to a colorControlHighlight value defined in attr xml.

attrs.xml is a file located in:


Here, all of the attributes, that you may use in your app, are located.

If we check that file, we will find

<attr name="colorControlHighlight" format="color" /> string,

which means that colorControlHighlight itself is a reference to a color.

And all attributes declared here are just references to another values.
The actual values are assigned in themes.xml file, which, in it’s turn, is located in:


If we check that file, we’ll find, that there are a lot of themes, which are using our colorControlHighlight reference. So whether you are using one theme or another in your application, the colorControlHighlight values would be different for each of them.

In our case there are 2 themes:

<item name="colorControlHighlight">@color/legacy_button_pressed</item>
for Theme


<item name="colorControlHighlight">@color/legacy_light_button_pressed</item> for Theme.Light

Here we see another references instead of values. But now they refer to the color attribute: @color/. Thus we need to move to the color.xml files.

These are






Simple file check brings out the actual values we were looking for:

in the colors-legacy.xml file:

<color name="legacy_button_pressed">#fffea50b</color>


<color name="legacy_light_button_pressed">@color/legacy_button_pressed</color>
which also refers to the first color.

So, the color we searched for, was #fffea50b