Android - (Widget) State (Selected, ...)

> Android

1 - 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

3 - Example

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

  • pressed,
  • focused,
  • or neither

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

Advertising