public abstract class Animator extends Object implements Cloneable
AnimatorListeners
added to them.Modifier and Type | Class and Description |
---|---|
static interface |
Animator.AnimatorListener
An animation listener receives notifications from an animation.
|
Constructor and Description |
---|
Animator() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Animator.AnimatorListener listener)
Adds a listener to the set of listeners that are sent events through the life of an
animation, such as start, repeat, and end.
|
void |
cancel()
Cancels the animation.
|
Animator |
clone() |
void |
end()
Ends the animation.
|
abstract long |
getDuration()
Gets the length of the animation.
|
ArrayList<Animator.AnimatorListener> |
getListeners()
Gets the set of
android.animation.Animator.AnimatorListener objects that are currently
listening for events on this Animator object. |
abstract long |
getStartDelay()
The amount of time, in milliseconds, to delay starting the animation after
start() is called. |
abstract boolean |
isRunning()
Returns whether this Animator is currently running (having been started and gone past any
initial startDelay period and not yet ended).
|
boolean |
isStarted()
Returns whether this Animator has been started and not yet ended.
|
void |
removeAllListeners()
Removes all listeners from this object.
|
void |
removeListener(Animator.AnimatorListener listener)
Removes a listener from the set listening to this animation.
|
abstract Animator |
setDuration(long duration)
Sets the length of the animation.
|
abstract void |
setInterpolator(android.view.animation.Interpolator value)
The time interpolator used in calculating the elapsed fraction of this animation.
|
abstract void |
setStartDelay(long startDelay)
The amount of time, in milliseconds, to delay starting the animation after
start() is called. |
void |
setTarget(Object target)
Sets the target object whose property will be animated by this animation.
|
void |
setupEndValues()
This method tells the object to use appropriate information to extract
ending values for the animation.
|
void |
setupStartValues()
This method tells the object to use appropriate information to extract
starting values for the animation.
|
void |
start()
Starts this animation.
|
public void start()
Animator.AnimatorListener.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.
public void cancel()
end()
, cancel()
causes the animation to
stop in its tracks, sending an
android.animation.Animator.AnimatorListener#onAnimationCancel(Animator)
to
its listeners, followed by an
android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)
message.
This method must be called on the thread that is running the animation.
public void end()
android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)
method on
its listeners.
This method must be called on the thread that is running the animation.
public abstract long getStartDelay()
start()
is called.public abstract void setStartDelay(long startDelay)
start()
is called.startDelay
- The amount of the delay, in millisecondspublic abstract Animator setDuration(long duration)
duration
- The length of the animation, in milliseconds.public abstract long getDuration()
public abstract void setInterpolator(android.view.animation.Interpolator value)
AccelerateDecelerateInterpolator
value
- the interpolator to be used by this animationpublic abstract boolean isRunning()
public boolean isStarted()
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.public void addListener(Animator.AnimatorListener listener)
listener
- the listener to be added to the current set of listeners for this animation.public void removeListener(Animator.AnimatorListener listener)
listener
- the listener to be removed from the current set of listeners for this
animation.public ArrayList<Animator.AnimatorListener> getListeners()
android.animation.Animator.AnimatorListener
objects that are currently
listening for events on this Animator
object.public void removeAllListeners()
getListeners()
followed by calling clear()
on the
returned list of listeners.public void setupStartValues()
public void setupEndValues()
public void setTarget(Object target)
ValueAnimator
, but this method
is on the superclass for the convenience of dealing generically with those subclasses
that do handle targets.target
- The object being animatedCopyright © 2011–2014. All rights reserved.