Fade
This package is part of the
Android support library which
is no longer maintained.
The support library has been superseded by AndroidX
which is part of Jetpack.
We recommend using the AndroidX libraries in all new projects. You should also consider
migrating existing projects to AndroidX.
To find the AndroidX class that maps to this deprecated class, see the AndroidX
support library class
mappings.
public
class
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. Visibility is determined by both the
The ability of this transition to fade out a particular view, and the
way that that fading operation takes place, is based on
the situation of the view in the view hierarchy. For example, if a view was
simply removed from its parent, then the view will be added into a
A Fade transition can be described in a resource file by using the
tag fade, along with the standard
attributes of Fade and
Summary
Constants
int
Fading mode used in
int
Fading mode used in
Inherited constants
From
class
int
Mode used in
int
Mode used in
Public constructors
Fade(int fadingMode)
Constructs a Fade transition that will fade targets in
and/or out, according to the value of fadingMode.
Constructs a Fade transition that will fade targets in and out.
Public methods
void
Captures the values in the start scene for the properties that this
transition monitors.
The default implementation of this method returns a null Animator.
The default implementation of this method returns a null Animator.
Inherited methods
From
class
void
Captures the values in the end scene for the properties that this
transition monitors.
void
Captures the values in the start scene for the properties that this
transition monitors.
This method creates an animation that will be run for this transition
given the information in the startValues and endValues structures captured
earlier for the start and end scenes.
int
Returns whether appearing and/or disappearing Views are supported.
String[]
Returns the set of property names used stored in the
boolean
Returns whether or not the transition should create an Animator, based on the values
captured during
boolean
Returns whether the view is 'visible' according to the given values
object.
onAppear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, TransitionValues endValues, int endVisibility)
The default implementation of this method does nothing.
The default implementation of this method returns a null Animator.
onDisappear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, TransitionValues endValues, int endVisibility)
The default implementation of this method does nothing.
The default implementation of this method returns a null Animator.
void
setMode(int mode)
Changes the transition to support appearing and/or disappearing Views, depending
on mode.
From
class
Adds a listener to the set of listeners that are sent events through the
life of an animation, such as start, repeat, and end.
Sets the target view instances that this Transition is interested in
animating.
addTarget(int targetId)
Adds the id of a target view that this Transition is interested in
animating.
addTarget(Class targetType)
Adds the Class of a target view that this Transition is interested in
animating.
addTarget(String targetName)
Adds the transitionName of a target view that this Transition is interested in
animating.
abstract
void
Captures the values in the end scene for the properties that this
transition monitors.
abstract
void
Captures the values in the start scene for the properties that this
transition monitors.
This method creates an animation that will be run for this transition
given the information in the startValues and endValues structures captured
earlier for the start and end scenes.
excludeChildren(int targetId, boolean exclude)
Whether to add the children of the given id to the list of targets to exclude
from this transition.
excludeChildren(Class type, boolean exclude)
Whether to add the given type to the list of types whose children should
be excluded from this transition.
excludeChildren(View target, boolean exclude)
Whether to add the children of given target to the list of target children
to exclude from this transition.
excludeTarget(View target, boolean exclude)
Whether to add the given target to the list of targets to exclude from this
transition.
excludeTarget(Class type, boolean exclude)
Whether to add the given type to the list of types to exclude from this
transition.
excludeTarget(String targetName, boolean exclude)
Whether to add the given transitionName to the list of target transitionNames to exclude
from this transition.
excludeTarget(int targetId, boolean exclude)
Whether to add the given id to the list of target ids to exclude from this
transition.
long
Returns the duration set on this transition.
Returns the epicenter as specified by the
Returns the callback used to find the epicenter of the Transition.
Returns the interpolator set on this transition.
String
Returns the name of this Transition.
Returns the algorithm object used to interpolate along two dimensions.
long
Returns the startDelay set on this transition.
List
Returns the array of target IDs that this transition limits itself to
tracking and animating.
List
Returns the list of target transitionNames that this transition limits itself to
tracking and animating.
List
Returns the list of target transitionNames that this transition limits itself to
tracking and animating.
List
Returns the array of target views that this transition limits itself to
tracking and animating.
String[]
Returns the set of property names used stored in the
This method can be called by transitions to get the TransitionValues for
any particular view during the transition-playing process.
boolean
Returns whether or not the transition should create an Animator, based on the values
captured during
Removes a listener from the set listening to this animation.
removeTarget(int targetId)
Removes the given targetId from the list of ids that this Transition
is interested in animating.
Removes the given target from the list of targets that this Transition
is interested in animating.
removeTarget(String targetName)
Removes the given targetName from the list of transitionNames that this Transition
is interested in animating.
removeTarget(Class target)
Removes the given target from the list of targets that this Transition
is interested in animating.
setDuration(long duration)
Sets the duration of this transition.
void
Sets the callback to use to find the epicenter of a Transition.
Sets the interpolator of this transition.
void
setMatchOrder(int... matches)
Sets the order in which Transition matches View start and end values.
void
Sets the algorithm used to calculate two-dimensional interpolation.
void
Sets the method for determining Animator start delays.
setStartDelay(long startDelay)
Sets the startDelay of this transition.
String
From
class
java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
final
Class>
getClass()
int
hashCode()
final
void
notify()
final
void
notifyAll()
String
toString()
final
void
wait(long arg0, int arg1)
final
void
wait(long arg0)
final
void
wait()
Constants
IN
int IN
Fading mode used in
Constant Value:
1
(0x00000001)
OUT
int OUT
Fading mode used in
Constant Value:
2
(0x00000002)
Public constructors
Fade
Fade (int fadingMode)
Constructs a Fade transition that will fade targets in
and/or out, according to the value of fadingMode.
Parameters
fadingMode
int: The behavior of this transition, a combination of
Fade
Fade ()
Constructs a Fade transition that will fade targets in and out.
Fade
Fade (Context context,
AttributeSet attrs)
Parameters
context
Context
attrs
AttributeSet
Public methods
captureStartValues
void captureStartValues (TransitionValues transitionValues)
Captures the values in the start scene for the properties that this
transition monitors. These values are then passed as the startValues
structure in a later call to
Subclasses must implement this method. The method should only be called by the
transition system; it is not intended to be called from external classes.
Parameters
transitionValues
TransitionValues: The holder for any values that the Transition
wishes to store. Values are stored in the values field
of this TransitionValues object and are keyed from
a String value. For example, to store a view's rotation value,
a transition might call
transitionValues.values.put("appname:transitionname:rotation",
view.getRotation()). The target view will already be stored
in
the transitionValues structure when this method is called.
onAppear
The default implementation of this method returns a null Animator. Subclasses should
override this method to make targets appear with the desired transition. The
method should only be called from
Parameters
sceneRoot
ViewGroup: The root of the transition hierarchy
view
View: The View to make appear. This will be in the target scene's View
hierarchy
and
will be VISIBLE.
startValues
TransitionValues: The target values in the start scene
endValues
TransitionValues: The target values in the end scene
Returns
An Animator to be started at the appropriate time in the
overall transition for this scene change. A null value means no animation
should be run.
onDisappear
The default implementation of this method returns a null Animator. Subclasses should
override this method to make targets disappear with the desired transition. The
method should only be called from
Parameters
sceneRoot
ViewGroup: The root of the transition hierarchy
view
View: The View to make disappear. This will be in the target scene's View
hierarchy or in an
startValues
TransitionValues: The target values in the start scene
endValues
TransitionValues: The target values in the end scene
Returns
An Animator to be started at the appropriate time in the
overall transition for this scene change. A null value means no animation
should be run.