AnimatorGroup, AnimatorProperty, AnimatorValue, AnimatorVectorpublic abstract class Animator extends Object
This class provides basic support for animators. Besides starting, stopping, pausing, and resuming the animator, it allows you to obtain the animator duration, startup delay, repetition times, and specified curve types.
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
Animator.CurveType |
Provides curve types supported by the system.
|
static interface |
Animator.LoopedListener |
Listens for animator repeat events.
|
static interface |
Animator.StateChangedListener |
Listens for animator state changes.
|
static interface |
Animator.TimelineCurve |
Provides the method to obtain the value that represents a fraction in the timeline curve
based on the specified time.
|
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
INFINITE |
Indicates an animator that repeats constantly.
|
protected Animator.LoopedListener |
mLoopedListener |
Indicates the callback invoked when repeating an animator.
|
protected Animator.StateChangedListener |
mPauseListener |
Indicates the callback invoked when pausing or resuming an animator.
|
protected Animator.StateChangedListener |
mStartListener |
Indicates the callback invoked when starting an animator.
|
| 构造器 | 说明 |
|---|---|
Animator() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
cancel() |
Cancels an animator and returns to the initial state.
|
void |
end() |
Ends an animator and moves to the end state.
|
int |
getCurveType() |
Obtains the curve type of an animator.
|
long |
getDelay() |
Obtains the startup delay of an animator.
|
long |
getDuration() |
Obtains the duration of an animator.
|
int |
getLoopedCount() |
Obtains the repetition times of an animator.
|
boolean |
isPaused() |
Checks if an animator is paused.
|
boolean |
isRunning() |
Checks if an animator is running.
|
void |
pause() |
Pauses an animator.
|
void |
release() |
Releases native resources.
|
void |
resume() |
Resumes an animator.
|
protected void |
setCurveInternal(Animator.TimelineCurve curve) |
Sets a timeline curve for this
Animator object. |
protected void |
setCurveTypeInternal(int curveType) |
Sets the curve type.
|
protected void |
setDelayInternal(long startDelay) |
Sets the startup delay of an animator.
|
protected void |
setDurationInternal(long duration) |
Sets the duration of an animator.
|
protected void |
setLoopedCountInternal(int loopedCount) |
Specifies the repetition times of an animator.
|
protected void |
setLoopedListenerInternal(Animator.LoopedListener listener) |
Sets the repeat listener for animators.
|
protected void |
setPauseListenerInternal(Animator.StateChangedListener listener) |
Sets the pause and resume listener for animators.
|
protected void |
setStartListenerInternal(Animator.StateChangedListener listener) |
Sets the start listener for animators.
|
void |
start() |
Starts an animator.
|
void |
stop() |
Stops an animator in the current state.
|
public static final int INFINITE
protected Animator.LoopedListener mLoopedListener
protected Animator.StateChangedListener mPauseListener
protected Animator.StateChangedListener mStartListener
public void start()
public void stop()
public void cancel()
public void end()
public void pause()
resume()public void resume()
pause()public boolean isPaused()
True if the animator is paused; returns False otherwise.public boolean isRunning()
True if the animator is running; returns False otherwise.public long getDuration()
public long getDelay()
public int getLoopedCount()
public int getCurveType()
protected void setDurationInternal(long duration)
duration - Specifies the duration of an animator.
The value must be greater than or equal to 0, in unit of milliseconds.protected void setDelayInternal(long startDelay)
startDelay - Specifies the startup delay of an animator.
The value must be greater than or equal to 0, in unit of milliseconds.protected void setLoopedCountInternal(int loopedCount)
loopedCount - Specifies the repetition times of an animator.
The value must be greater than or equal to 0, or INFINITE.protected void setCurveTypeInternal(int curveType)
curveType - Specifies the curve type.
Ensure that the specified type is supported in the system.protected void setCurveInternal(Animator.TimelineCurve curve)
Animator object.curve - Indicates the curve to set.protected void setPauseListenerInternal(Animator.StateChangedListener listener)
listener - Specifies the pause and resume listener for animators.protected void setLoopedListenerInternal(Animator.LoopedListener listener)
listener - Specifies the repeat listener for animators.protected void setStartListenerInternal(Animator.StateChangedListener listener)
listener - Specifies the start listener for animators.public void release()