public class AnimatedStateListDrawableCompat
extends Drawable implements Drawable.Callback


A Drawable providing animated transitions between states.

A port of AnimatedStateListDrawable compatible with older versions of the platform.

This drawable can be defined in an XML file with the <animated-selector> element. Each keyframe Drawable is defined in a nested <item> element. Transitions are defined in a nested <transition> element.

Notable exceptions not supported by this class:

  • drawables defined as children of <item>s or <transition>s (except vectors) ignore theme attributes prior to API level 21
  • Animated vector transitions do not support reversing prior to API level 24
R.attr.state_focused R.attr.state_window_focused R.attr.state_enabled R.attr.state_checkable R.attr.state_checked R.attr.state_selected R.attr.state_activated R.attr.state_active R.attr.state_single R.attr.state_first R.attr.state_middle R.attr.state_last R.attr.state_pressed


Public constructors


Public methods

void addState(int[] stateSet, Drawable drawable, int id)

Add a new drawable to the set of keyframes.

void addState(int[] stateSet, Drawable drawable)

Add a new image/string ID to the set of images.

<T extends Drawable & Animatable> void addTransition(int fromId, int toId, T transition, boolean reversible)

Adds a new transition between keyframes.

void applyTheme(Resources.Theme theme)
boolean canApplyTheme()
static AnimatedStateListDrawab