| java.lang.Object | ||
| ↳ | android.animation.Animator | |
| ↳ | android.animation.AnimatorSet | |
This class plays a set of Animator objects in the specified order. Animations
 can be set up to play together, in sequence, or after a specified delay.
 
There are two different approaches to adding animations to a AnimatorSet:
 either the playTogether() or
 playSequentially() methods can be called to add
 a set of animations all at once, or the play(Animator) can be
 used in conjunction with methods in the Builder
 class to add animations
 one by one.
It is possible to set up a AnimatorSet with circular dependencies between
 its animations. For example, an animation a1 could be set up to start before animation a2, a2
 before a3, and a3 before a1. The results of this configuration are undefined, but will typically
 result in none of the affected animations being played. Because of this (and because
 circular dependencies do not make logical sense anyway), circular dependencies
 should be avoided, and the dependency flow of animations should only be in one direction.
 
For more information about animating with AnimatorSet, read the
 Property
 Animation developer guide.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| AnimatorSet.Builder | The Builderobject is a utility class to facilitate adding animations to aAnimatorSetalong with the relationships between the various animations. | ||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Cancels the animation.
  Note that canceling a  | |||||||||||
| Creates and returns a copy of this  Object. | |||||||||||
| Ends the animation.
  Note that ending a  | |||||||||||
| Returns the current list of child Animator objects controlled by this
 AnimatorSet. | |||||||||||
| Gets the length of each of the child animations of this AnimatorSet. | |||||||||||
| Returns the timing interpolator that this animation uses. | |||||||||||
| The amount of time, in milliseconds, to delay starting the animation after
  start()is called. | |||||||||||
| Returns true if any of the child animations of this AnimatorSet have been started and have
 not yet ended. | |||||||||||
| Returns whether this Animator has been started and not yet ended. | |||||||||||
| Pauses a running animation. | |||||||||||
| This method creates a  Builderobject, which is used to
 set up playing constraints. | |||||||||||
| Sets up this AnimatorSet to play each of the supplied animations when the
 previous animation ends. | |||||||||||
| Sets up this AnimatorSet to play each of the supplied animations when the
 previous animation ends. | |||||||||||
| Sets up this AnimatorSet to play all of the supplied animations at the same time. | |||||||||||
| Sets up this AnimatorSet to play all of the supplied animations at the same time. | |||||||||||
| Resumes a paused animation, causing the animator to pick up where it left off
 when it was paused. | |||||||||||
| Sets the length of each of the current child animations of this AnimatorSet. | |||||||||||
| Sets the TimeInterpolator for all current  child animationsof this AnimatorSet. | |||||||||||
| The amount of time, in milliseconds, to delay starting the animation after
  start()is called. | |||||||||||
| Sets the target object for all current  child animationsof this AnimatorSet that take targets (ObjectAnimatorand
 AnimatorSet). | |||||||||||
| This method tells the object to use appropriate information to extract
 ending values for the animation. | |||||||||||
| This method tells the object to use appropriate information to extract
 starting values for the animation. | |||||||||||
| Starts this animation.
  Starting this  | |||||||||||
| [Expand] Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class
  android.animation.Animator | |||||||||||
|  From class
  java.lang.Object | |||||||||||
Cancels the animation. Unlike end(), cancel() causes the animation to
 stop in its tracks, sending an
 onAnimationCancel(Animator) to
 its listeners, followed by an
 onAnimationEnd(Animator) message.
 
This method must be called on the thread that is running the animation.
Note that canceling a AnimatorSet also cancels all of the animations that it
 is responsible for.
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.
Ends the animation. This causes the animation to assign the end value of the property being
 animated, then calling the
 onAnimationEnd(Animator) method on
 its listeners.
 
This method must be called on the thread that is running the animation.
Note that ending a AnimatorSet also ends all of the animations that it is
 responsible for.
Returns the current list of child Animator objects controlled by this AnimatorSet. This is a copy of the internal list; modifications to the returned list will not affect the AnimatorSet, although changes to the underlying Animator objects will affect those objects being managed by the AnimatorSet.
Gets the length of each of the child animations of this AnimatorSet. This value may be less than 0, which indicates that no duration has been set on this AnimatorSet and each of the child animations will use their own duration.
Returns the timing interpolator that this animation uses.
The amount of time, in milliseconds, to delay starting the animation after
 start() is called.
Returns true if any of the child animations of this AnimatorSet have been started and have not yet ended.
Returns whether this Animator has been started and not yet ended. This state is a superset
 of the state of isRunning(), because an Animator with a nonzero
 startDelay will return true for isStarted() during the
 delay phase, whereas isRunning() will return true only after the delay phase
 is complete.
This method creates a Builder object, which is used to
 set up playing constraints. This initial play() method
 tells the Builder the animation that is the dependency for
 the succeeding commands to the Builder. For example,
 calling play(a1).with(a2) sets up the AnimatorSet to play
 a1 and a2 at the same time,
 play(a1).before(a2) sets up the AnimatorSet to play
 a1 first, followed by a2, and
 play(a1).after(a2) sets up the AnimatorSet to play
 a2 first, followed by a1.
 
Note that play() is the only way to tell the
 Builder the animation upon which the dependency is created,
 so successive calls to the various functions in Builder
 will all refer to the initial parameter supplied in play()
 as the dependency of the other animations. For example, calling
 play(a1).before(a2).before(a3) will play both a2
 and a3 when a1 ends; it does not set up a dependency between
 a2 and a3.
| anim | The animation that is the dependency used in later calls to the
 methods in the returned Builderobject. A null parameter will result
 in a nullBuilderreturn value. | 
|---|
play and the other methods in the
 BuilderSets up this AnimatorSet to play each of the supplied animations when the previous animation ends.
| items | The animations that will be started one after another. | 
|---|
Sets up this AnimatorSet to play each of the supplied animations when the previous animation ends.
| items | The animations that will be started one after another. | 
|---|
Sets up this AnimatorSet to play all of the supplied animations at the same time.
| items | The animations that will be started simultaneously. | 
|---|
Sets up this AnimatorSet to play all of the supplied animations at the same time.
 This is equivalent to calling play(Animator) with the first animator in the
 set and then with(Animator) with each of the other animators. Note that
 an Animator with a startDelay will not actually
 start until that delay elapses, which means that if the first animator in the list
 supplied to this constructor has a startDelay, none of the other animators will start
 until that first animator's startDelay has elapsed.
| items | The animations that will be started simultaneously. | 
|---|
Resumes a paused animation, causing the animator to pick up where it left off when it was paused. This method should only be called on the same thread on which the animation was started. Calls to resume() on an animator that is not currently paused will be ignored.
Sets the length of each of the current child animations of this AnimatorSet. By default, each child animation will use its own duration. If the duration is set on the AnimatorSet, then each child animation inherits this duration.
| duration | The length of the animation, in milliseconds, of each of the child animations of this AnimatorSet. | 
|---|
Sets the TimeInterpolator for all current child animations
 of this AnimatorSet. The default value is null, which means that no interpolator
 is set on this AnimatorSet. Setting the interpolator to any non-null value
 will cause that interpolator to be set on the child animations
 when the set is started.
| interpolator | the interpolator to be used by each child animation of this AnimatorSet | 
|---|
The amount of time, in milliseconds, to delay starting the animation after
 start() is called.
| startDelay | The amount of the delay, in milliseconds | 
|---|
Sets the target object for all current child animations
 of this AnimatorSet that take targets (ObjectAnimator and
 AnimatorSet).
| target | The object being animated | 
|---|
This method tells the object to use appropriate information to extract ending values for the animation. For example, a AnimatorSet object will pass this call to its child objects to tell them to set up the values. A ObjectAnimator object will use the information it has about its target object and PropertyValuesHolder objects to get the start values for its properties. A ValueAnimator object will ignore the request since it does not have enough information (such as a target object) to gather these values.
This method tells the object to use appropriate information to extract starting values for the animation. For example, a AnimatorSet object will pass this call to its child objects to tell them to set up the values. A ObjectAnimator object will use the information it has about its target object and PropertyValuesHolder objects to get the start values for its properties. A ValueAnimator object will ignore the request since it does not have enough information (such as a target object) to gather these values.
Starts this animation. If the animation has a nonzero startDelay, the animation will start
 running after that delay elapses. A non-delayed animation will have its initial
 value(s) set immediately, followed by calls to
 onAnimationStart(Animator) for any listeners of this animator.
 
The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.
Starting this AnimatorSet will, in turn, start the animations for which
 it is responsible. The details of when exactly those animations are started depends on
 the dependency relationships that have been set up between the animations.