public final class MaterialSharedAxis

A androidx.transition.Visibility transition that provides shared motion along an axis.

When configured along the X axis, this transition slides and fades in the target when appearing and slides and fades out the target when disappearing.

When configured along the Y axis, this transition slides and fades in the target when appearing and slides and fades out the target when disappearing.

When configured along the Z axis, this transition scales and fades in when the target is appearing and scales and fades out when the target is disappearing.

The direction of the slide or scale is determined by the constructors's forward property. When true, the target will slide to the left on the X axis, up on the Y axis and out in on the Z axis. When false, the target will slide to the right on the X axis, down on the Y axis and in on the Z axis. Note that this is independent of whether or not the target is appearing or disappearing.

MaterialSharedAxis supports theme-based easing and duration. The transition will load theme values from the SceneRoot's context before it runs, and only use them if the corresponding properties weren't already set on the transition instance.

Summary

Constants

static final int

X = 0

Indicates that the x-axis should be shared for the transition, meaning a horizontal slide and fade should be used.

static final int

Y = 1

Indicates that the y-axis should be shared for the transition, meaning a vertical slide and fade should be used.

static final int

Z = 2

Indicates that the z-axis should be shared for the transition, meaning a scale and fade should be used.

Public methods

void

addAdditionalAnimatorProvider(
    VisibilityAnimatorProvider additionalAnimatorProvider
)

Adds an additional VisibilityAnimatorProvider, which provides animators be played together with the primary and secondary VisibilityAnimatorProviders.

void

Clears all additional VisibilityAnimatorProviders that were previously added.

int
P

Returns the primary VisibilityAnimatorProvider for this transition, which can be modified but not swapped out completely.

VisibilityAnimatorProvider

Returns the secondary VisibilityAnimatorProvider for this transition or null, which can be modified or swapped out completely for a different VisibilityAnimatorProvider.

boolean
boolean
Animator

onAppear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)

Animator

onDisappear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)

boolean

Removes an additional VisibilityAnimatorProvider that was previously added.

void

setSecondaryAnimatorProvider(
    VisibilityAnimatorProvider secondaryAnimatorProvider
)

Sets the secondary VisibilityAnimatorProvider, which provides animators to be played together with the primary VisibilityAnimatorProvider.

Constants

X

public static final int X = 0

Indicates that the x-axis should be shared for the transition, meaning a horizontal slide and fade should be used.

In the forward direction, targets of this transition will slide left.

Y

public static final int Y = 1

Indicates that the y-axis should be shared for the transition, meaning a vertical slide and fade should be used.

In the forward direction, targets of this transition will slide up.

Z

public static final int Z = 2

Indicates that the z-axis should be shared for the transition, meaning a scale and fade should be used.

In the forward direction, targets of this transition will scale out.

Public fields

axis

public final int axis

Public constructors

Public methods

onAppear

public Animator onAppear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)

onDisappear

public Animator onDisappear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025-10-28 UTC.