java.lang.Object | ||
↳ | android.view.animation.Animation | |
↳ | android.view.animation.AnimationSet |
Represents a group of Animations that should be played together. The transformation of each individual animation are composed together into a single transform. If AnimationSet sets any properties that its children also set (for example, duration or fillBefore), the values of AnimationSet override the child values.
The way that AnimationSet inherits behavior from Animation is important to understand. Some of the Animation attributes applied to AnimationSet affect the AnimationSet itself, some are pushed down to the children, and some are ignored, as follows:
ICE_CREAM_SANDWICH
,
the behavior of these properties is the same in XML resources and at runtime (prior to that
release, the values set in XML were ignored for AnimationSet). That is, calling
setDuration(500)
on an AnimationSet has the same effect as declaring
android:duration="500"
in an XML resource for an AnimationSet object.
[Expand]
Inherited XML Attributes
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.animation.Animation
|
[Expand]
Inherited Constants
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.animation.Animation
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Constructor used when an AnimationSet is loaded from a resource.
|
||||||||||
|
Constructor to use when building an AnimationSet from code
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Add a child animation to this animation set.
|
||||||||||
|
The duration hint of an animation set is the maximum of the duration
hints of all of its component animations.
|
||||||||||
|
|
||||||||||
|
The duration of an AnimationSet is defined to be the
duration of the longest child animation.
|
||||||||||
|
When this animation should start.
|
||||||||||
|
The transformation of an animation set is the concatenation of all of its
component animations.
|
||||||||||
|
Initialize this animation with the dimensions of the object being
animated as well as the objects parents.
|
||||||||||
|
Reset the initialization state of this animation.
|
||||||||||
|
Ensure that the duration that this animation will run is not longer
than
durationMillis
.
|
||||||||||
|
How much to scale the duration by.
|
||||||||||
|
Sets the duration of every child animation. |
||||||||||
|
If fillAfter is true, the transformation that this animation performed
will persist when it is finished.
|
||||||||||
|
If fillBefore is true, this animation will apply its transformation
before the start time of the animation.
|
||||||||||
|
Defines what this animation should do when it reaches the end.
|
||||||||||
|
When this animation should start relative to the start time.
|
||||||||||
|
Sets the start time of this animation and all child animations
|
||||||||||
|
Indicates whether or not this animation will affect the bounds of the animated view. |
||||||||||
|
Indicates whether or not this animation will affect the transformation matrix. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Creates and returns a copy of this
Object
.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.animation.Animation
|
|||||||||||
From class
java.lang.Object
|
Constructor used when an AnimationSet is loaded from a resource.
context | Application context to use |
---|---|
attrs | Attribute set from which to read values |
Constructor to use when building an AnimationSet from code
shareInterpolator | Pass true if all of the animations in this set should use the interpolator associated with this AnimationSet. Pass false if each animation should use its own interpolator. |
---|
Add a child animation to this animation set. The transforms of the child animations are applied in the order that they were added
a | Animation to add. |
---|
The duration hint of an animation set is the maximum of the duration hints of all of its component animations.
The duration of an AnimationSet is defined to be the duration of the longest child animation.
When this animation should start. If the animation has not startet yet,
this method might return
START_ON_FIRST_FRAME
.
START_ON_FIRST_FRAME
The transformation of an animation set is the concatenation of all of its component animations.
currentTime | Where we are in the animation. This is wall clock time. |
---|---|
t | A transformation object that is provided by the caller and will be filled in by the animation. |
Initialize this animation with the dimensions of the object being animated as well as the objects parents. (This is to support animation sizes being specified relative to these dimensions.)
Objects that interpret Animations should call this method when
the sizes of the object being animated and its parent are known, and
before calling
getTransformation(long, Transformation)
.
width | Width of the object being animated |
---|---|
height | Height of the object being animated |
parentWidth | Width of the animated object's parent |
parentHeight | Height of the animated object's parent |
Ensure that the duration that this animation will run is not longer than durationMillis . In addition to adjusting the duration itself, this ensures that the repeat count also will not make it run longer than the given time.
durationMillis | The maximum duration the animation is allowed to run. |
---|
How much to scale the duration by.
scale | The amount to scale the duration. |
---|
Sets the duration of every child animation.
durationMillis | the duration of the animation, in milliseconds, for every child in this set |
---|
If fillAfter is true, the transformation that this animation performed
will persist when it is finished. Defaults to false if not set.
Note that this applies to individual animations and when using an
AnimationSet
to chain
animations.
fillAfter | true if the animation should apply its transformation after it ends |
---|
If fillBefore is true, this animation will apply its transformation
before the start time of the animation. Defaults to true if
setFillEnabled(boolean)
is not set to true.
Note that this applies when using an
AnimationSet
to chain
animations. The transformation is not applied before the AnimationSet
itself starts.
fillBefore | true if the animation should apply its transformation before it starts |
---|
When this animation should start relative to the start time. This is most
useful when composing complex animations using an
AnimationSet
where some of the animations components start at different times.
startOffset | When this Animation should start, in milliseconds from the start time of the root AnimationSet. |
---|
Sets the start time of this animation and all child animations
startTimeMillis | the start time in milliseconds |
---|
Indicates whether or not this animation will affect the bounds of the animated view. For instance, a fade animation will not affect the bounds whereas a 200% scale animation will.
Indicates whether or not this animation will affect the transformation matrix. For instance, a fade animation will not affect the matrix whereas a scale animation will.
Creates and returns a copy of this
Object
. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call
super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.
CloneNotSupportedException |
---|