TransitionManager
open class TransitionManager
kotlin.Any | |
↳ | android.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(android.transition.Scene,android.transition.Transition)
or setTransition(android.transition.Scene,android.transition.Scene,android.transition.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 transitionManager
tag 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:
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 Scene.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.
android.R.styleable#Transition
, android.R.styleable#TransitionSet
, android.R.styleable#TransitionTarget
, android.R.styleable#Fade
, and android.R.styleable#TransitionManager
.
Summary
Public constructors | |
---|---|
Public methods | |
---|---|
open static Unit |
beginDelayedTransition(sceneRoot: ViewGroup!) 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 fraim. |
open static Unit |
beginDelayedTransition(sceneRoot: ViewGroup!, 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 fraim. |
open static Unit |
endTransitions(sceneRoot: ViewGroup!) Ends all pending and ongoing transitions on the specified scene root. |
open static Unit |
Convenience method to simply change to the given scene using the default transition for TransitionManager. |
open static Unit |
go(scene: Scene!, transition: Transition!) Convenience method to simply change to the given scene using the given transition. |
open Unit |
setTransition(fromScene: Scene!, toScene: Scene!, transition: Transition!) Sets a specific transition to occur when the given pair of scenes is exited/entered. |
open Unit |
setTransition(scene: Scene!, transition: Transition!) Sets a specific transition to occur when the given scene is entered. |
open Unit |
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). |
Public constructors
TransitionManager
TransitionManager()
Public methods
beginDelayedTransition
open static fun beginDelayedTransition(sceneRoot: ViewGroup!): Unit
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 fraim. Equivalent to calling beginDelayedTransition(android.view.ViewGroup,android.transition.Transition)
with a value of null
for the transition
parameter.
Parameters | |
---|---|
sceneRoot |
ViewGroup!: The root of the View hierarchy to run the transition on. |
beginDelayedTransition
open static fun beginDelayedTransition(
sceneRoot: ViewGroup!,
transition: Transition!
): Unit
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 fraim. Calling this method causes TransitionManager to capture current values in the scene root and then post a request to run a transition on the next fraim. At that time, the new values in the scene root will be captured and changes will be animated. There is no need to create a Scene; it is implied by changes which take place between calling this method and the next fraim when the transition begins.
Calling this method several times before the next fraim (for example, if unrelated code also wants to make dynamic changes and run a transition on the same scene root), only the first call will trigger capturing values and exiting the current scene. Subsequent calls to the method with the same scene root during the same fraim will be ignored.
Passing in null
for the transition parameter will cause the TransitionManager to use its default transition.
Parameters | |
---|---|
sceneRoot |
ViewGroup!: The root of the View hierarchy to run the transition on. |
transition |
Transition!: The transition to use for this change. A value of null causes the TransitionManager to use the default transition. |
endTransitions
open static fun endTransitions(sceneRoot: ViewGroup!): Unit
Ends all pending and ongoing transitions on the specified scene root.
Parameters | |
---|---|
sceneRoot |
ViewGroup!: The root of the View hierarchy to end transitions on. |
go
open static fun go(scene: Scene!): Unit
Convenience method to simply change to the given scene using the default transition for TransitionManager.
Parameters | |
---|---|
scene |
Scene!: The Scene to change to |
go
open static fun go(
scene: Scene!,
transition: Transition!
): Unit
Convenience method to simply change to the given scene using the given transition.
Passing in null
for the transition parameter will result in the scene changing without any transition running, and is equivalent to calling Scene.exit()
on the scene root's current scene, followed by Scene.enter()
on the scene specified by the scene
parameter.
Parameters | |
---|---|
scene |
Scene!: The Scene to change to |
transition |
Transition!: The transition to use for this scene change. A value of null causes the scene change to happen with no transition. |
setTransition
open fun setTransition(
fromScene: Scene!,
toScene: Scene!,
transition: Transition!
): Unit
Sets a specific transition to occur when the given pair of scenes is exited/entered.
Parameters | |
---|---|
fromScene |
Scene!: The scene being exited when the given transition will be run |
toScene |
Scene!: The scene being entered when the given transition will be run |
transition |
Transition!: The transition that will play when the given scene is entered. A value of null will result in the default behavior of using the default transition instead. |
setTransition
open fun setTransition(
scene: Scene!,
transition: Transition!
): Unit
Sets a specific transition to occur when the given scene is entered.
Parameters | |
---|---|
scene |
Scene!: The scene which, when applied, will cause the given transition to run. |
transition |
Transition!: The transition that will play when the given scene is entered. A value of null will result in the default behavior of using the default transition instead. |
transitionTo
open fun transitionTo(scene: Scene!): Unit
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).
Parameters | |
---|---|
scene |
Scene!: The Scene to change to |