Android Resources edit

Define a color state list

Color state lists can be used as colors, but will change depending on the state of the view they are used for.

To define one, create a resource file in res/color/foo.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="">
    <item android:color="#888888" android:state_enabled="false"/>
    <item android:color="@color/lightGray" android:state_selected="false"/>
    <item android:color="@android:color/white" />

Items are evaluated in the order they are defined, and the first item whose specified states match the current state of the view is used. So it’s a good practice to specify a catch-all at the end, without any state selectors specified.

Each item can either use a color literal, or reference a color defined somewhere else.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents
9 Resources
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close