TransitionDrawable
TransitionDrawable is a subclass of Drawable that provides animated transitions between a sequence of drawables. It is part of the Android framework (android.graphics.drawable) and can be used to create visual effects such as fades or cross‑fades in user interfaces.
A TransitionDrawable is constructed from an array of Drawable objects. The array defines the order of the
The drawable also supports other operations inherited from Drawable, such as setBounds(Rect), setAlpha(int), and setColorFilter(ColorFilter). It
Typical usage examples include:
* Changing background colors or images when a button is pressed.
* Animating theme changes in a settings screen.
* Providing smooth visual feedback during configuration changes.
To use a TransitionDrawable programmatically:
1. Create an array of Drawable objects.
2. Instantiate the TransitionDrawable with the array.
3. Attach the drawable to a view using setBackground() or setImageDrawable().
4. Call startTransition() with the desired duration to begin the animation.
TransitionDrawable can be combined with animation listeners if finer control is required, for example by wrapping