StateListDrawable
StateListDrawable is an Android drawable subclass that manages a limited set of drawable resources keyed by view states. It is commonly used to provide different visual representations for UI components such as buttons, checkboxes, and list items depending on their current state (pressed, focused, selected, enabled, etc.). The drawable map is defined in an XML file located in the res/drawable directory, using the <selector> element to list each <item> with a state specification. When the Android framework renders a view, it queries the StateListDrawable for the drawable that matches the view’s current state set and displays it.
The state list can reference other drawables (bitmaps, shape XMLs, or color resources) as well as nine-patch
To use a StateListDrawable, a developer can assign it to a view’s background attribute in XML or