Table of Contents

Android - (Widget) State (Selected, …)

About

An element state is implemented through a Drawable State List.

A StateListDrawable is a drawable object defined in XML that uses a several different images to represent the same graphic, depending on the state of the object.

See also: bundle stateSavedInstance

Example

For example, a Button widget can exist in one of several different states:

and, using a state list drawable, you can provide a different background image for each state.