added in version 25.1.0
belongs to Maven artifact com.android.support:transition:28.0.0-alpha1

TransitionManager

public class TransitionManager
extends Object

java.lang.Object
   ↳ android.support.transition.TransitionManager


This class manages the set of transitions that fire when there is a change of Scene. To use the manager, add scenes along with transition objects with calls to setTransition(Scene, Transition) or setTransition(Scene, Scene, Transition). Setting specific transitions for scene changes is not required; by default, a Scene change will use AutoTransition to do something reasonable for most situations. Specifying other transitions for particular scene changes is only necessary if the application wants different transition behavior in these situations.

TransitionManagers can be declared in XML resource files inside the res/transition directory. TransitionManager resources consist of the transitionManagertag name, containing one or more transition tags, each of which describe the relationship of that transition to the from/to scene information in that tag. For example, here is a resource file that declares several scene transitions:

     <transitionManager xmlns:android="http://schemas.android.com/apk/res/android">
         <transition android:fromScene="@layout/transition_scene1"
                     android:toScene="@layout/transition_scene2"
                     android:transition="@transition/changebounds"/>
         <transition android:fromScene="@layout/transition_scene2"
                     android:toScene="@layout/transition_scene1"
                     android:transition="@transition/changebounds"/>
         <transition android:toScene="@layout/transition_scene3"
                     android:transition="@transition/changebounds_fadein_together"/>
         <transition android:fromScene="@layout/transition_scene3"
                     android:toScene="@layout/transition_scene1"
                     android:transition="@transition/changebounds_fadeout_sequential"/>
         <transition android:fromScene="@layout/transition_scene3"
                     android:toScene="@layout/transition_scene2"
                     android:transition="@transition/changebounds_fadeout_sequential"/>
     </transitionManager>
 

For each of the fromScene and toScene attributes, there is a reference to a standard XML layout file. This is equivalent to creating a scene from a layout in code by calling getSceneForLayout(ViewGroup, int, Context). For the transition attribute, there is a reference to a resource file in the res/transition directory which describes that transition.

Summary

Public constructors

TransitionManager()

Public methods

static void beginDelayedTransition(ViewGroup sceneRoot, Transition transition)

Convenience method to animate to a new scene defined by all changes within the given scene root between calling this method and the next rendering frame.

static void beginDelayedTransition(ViewGroup sceneRoot)

Convenience method to animate, using the default transition, to a new scene defined by all changes within the given scene root between calling this method and the next rendering frame.

static void endTransitions(ViewGroup sceneRoot)

Ends all pending and ongoing transitions on the specified scene root.

static void go(Scene scene)

Convenience method to simply change to the given scene using the default transition for TransitionManager.

static void go(Scene scene, Transition transition)

Convenience method to simply change to the given scene using the given transition.

void setTransition(Scene fromScene, Scene toScene, Transition transition)

Sets a specific transition to occur when the given pair of scenes is exited/entered.

void setTransition(Scene scene, Transition transition)

Sets a specific transition to occur when the given scene is entered.

void transitionTo(Scene scene)

Change to the given scene, using the appropriate transition for this particular scene change (as specified to the TransitionManager, or the default if no such transition exists).

Inherited methods

From class java.lang.Object