Reputation: 4518
I have a search button and I want the background color to be a light blue. Here is my ImageButton
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_search"
android:background="@android:color/searchBlue"/>
I want the background color to be a light blue. But @android:color/searchBlue
is highlighted red. Here is my colors.xml
file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="loomiusBlue">#00A6FF</color>
<color name="white">#FFFFFF</color>
<color name="headBlue">#2196F3</color>
<color name="searchBlue">#B3E5FC</color>
</resources>
Upvotes: 0
Views: 1366
Reputation: 9870
If the color searchBlue
is defined by Yourself inside a color.xml
, You have to use
android:background="@color/searchBlue"
instead. @android
will refere to android resources and not your resources.
Upvotes: 1
Reputation: 16651
This is wrong, because this searches for this color resource in the core android resources, not your local resources:
android:background="@android:color/searchBlue"
This should work, if this color exists in your color.xml:
android:background="@color/searchBlue"
Upvotes: 1