androidx.transition


AndroidX Transition Library provides Transition API back to API level 14.

Transition API allows you to animate various kinds of layout changes automatically. For example, you can present a change of visibility as fade in / out animation like below:

    TextView message = findViewById(R.id.message);
    ViewGroup container = findViewById(R.id.container);
    Fade fade = new Fade();

    TransitionManager.beginDelayedTransition(container, fade);
    message.setVisibility(View.INVISIBLE);
See also
<a href="https://developer.android.com/training/transitions">Transition API Guide</a>

Interfaces

Transition.TransitionListener

A transition listener receives notifications from a transition.

TransitionSeekController

Returned from controlDelayedTransition to allow manually controlling the animations within a Transition using setCurrentPlayTimeMillis.

Classes

ArcMotion

A PathMotion that generates a curved path along an arc on an imaginary circle containing the two points.

AutoTransition

Utility class for creating a default transition that automatically fades, moves, and resizes views during a scene change.

ChangeBounds

This transition captures the layout bounds of target views before and after the scene change and animates those changes during the transition.

ChangeClipBounds

ChangeClipBounds captures the getClipBounds before and after the scene change and animates those changes during the transition.

ChangeImageTransform

This Transition captures an ImageView's matrix before and after the scene change and animates it during the transition.

ChangeScroll

This transition captures the scroll properties of targets before and after the scene change and animates any changes.

ChangeTransform

This Transition captures scale and rotation for Views before and after the scene change and animates those changes during the transition.

CircularPropagation

A propagation that varies with the distance to the epicenter of the Transition or center of the scene if no epicenter exists.

Explode

This transition tracks changes to the visibility of target views in the start and end scenes and moves views in or out from the edges of the scene.

Fade

This transition tracks changes to the visibility of target views in the start and end scenes and fades views in or out when they become visible or non-visible.

PathMotion

This base class can be extended to provide motion along a Path to Transitions.

PatternPathMotion

A PathMotion that takes a Path pattern and applies it to the separation between two points.

Scene

A scene represents the collection of values that various properties in the View hierarchy will have when the scene is applied.

SidePropagation

A TransitionPropagation that propagates based on the distance to the side and, orthogonally, the distance to epicenter.

Slide

This transition tracks changes to the visibility of target views in the start and end scenes and moves views in or out from one of the edges of the scene.

Transition

A Transition holds information about animations that will be run on its targets during a scene change.

Transition.EpicenterCallback

Class to get the epicenter of Transition.

TransitionInflater

This class inflates scenes and transitions from resource files.

TransitionListenerAdapter

This adapter class provides empty implementations of the methods from .

TransitionManager

This class manages the set of transitions that fire when there is a change of Scene.

TransitionPropagation

Extend TransitionPropagation to customize start delays for Animators created in createAnimator.

TransitionSet

A TransitionSet is a parent of child transitions (including other TransitionSets).

TransitionValues

Data structure which holds cached values for the transition.

Visibility

This transition tracks changes to the visibility of target views in the start and end scenes.

VisibilityPropagation

Base class for TransitionPropagations that care about View Visibility and the center position of the View.

Extension functions summary

inline Transition.TransitionListener
Transition.addListener(
    crossinline onEnd: (transition: Transition) -> Unit,
    crossinline onStart: (transition: Transition) -> Unit,
    crossinline onCancel: (transition: Transition) -> Unit,
    crossinline onResume: (transition: Transition) -> Unit,
    crossinline onPause: (transition: Transition) -> Unit
)

Add a listener to this Transition using the provided actions.

inline Transition.TransitionListener
Transition.doOnCancel(
    crossinline action: (transition: Transition) -> Unit
)

Add an action which will be invoked when this transition has been cancelled.

inline Transition.TransitionListener
Transition.doOnEnd(crossinline action: (transition: Transition) -> Unit)

Add an action which will be invoked when this transition has ended.

inline Transition.TransitionListener
Transition.doOnPause(crossinline action: (transition: Transition) -> Unit)

Add an action which will be invoked when this transition has been paused.

inline Transition.TransitionListener
Transition.doOnResume(
    crossinline action: (transition: Transition) -> Unit
)

Add an action which will be invoked when this transition has resumed after a pause.

inline Transition.TransitionListener
Transition.doOnStart(crossinline action: (transition: Transition) -> Unit)

Add an action which will be invoked when this transition has started.

Extension functions

addListener

inline fun Transition.addListener(
    crossinline onEnd: (transition: Transition) -> Unit = {},
    crossinline onStart: (transition: Transition) -> Unit = {},
    crossinline onCancel: (transition: Transition) -> Unit = {},
    crossinline onResume: (transition: Transition) -> Unit = {},
    crossinline onPause: (transition: Transition) -> Unit = {}
): Transition.TransitionListener

Add a listener to this Transition using the provided actions.

doOnCancel

inline fun Transition.doOnCancel(
    crossinline action: (transition: Transition) -> Unit
): Transition.TransitionListener

Add an action which will be invoked when this transition has been cancelled.

inline fun Transition.doOnEnd(crossinline action: (transition: Transition) -> Unit): Transition.TransitionListener

Add an action which will be invoked when this transition has ended.

inline fun Transition.doOnPause(crossinline action: (transition: Transition) -> Unit): Transition.TransitionListener

Add an action which will be invoked when this transition has been paused.

doOnResume

inline fun Transition.doOnResume(
    crossinline action: (transition: Transition) -> Unit
): Transition.TransitionListener

Add an action which will be invoked when this transition has resumed after a pause.

inline fun Transition.doOnStart(crossinline action: (transition: Transition) -> Unit): Transition.TransitionListener

Add an action which will be invoked when this transition has started.