public class TimeAnimator
extends ValueAnimator
| java.lang.Object | |||
| android.animation.Animator | |||
| android.animation.ValueAnimator | |||
| android.animation.TimeAnimator | |||
该类为侦听器提供了一个简单的回调机制,与系统中的所有其他动画人员同步。 此动画制作器没有持续时间,插值或对象值设置。 相反,它只是简单地启动,之后它会继续发送每个动画帧上的事件给它的TimeListener(如果设置),以及有关此动画器的信息,总时间以及自上一个动画帧以来的经过时间。
Nested classes |
|
|---|---|
interface |
TimeAnimator.TimeListener 该接口的实现者可以将自己设置为 |
Inherited constants |
|---|
android.animation.ValueAnimator
|
android.animation.Animator
|
Public constructors |
|
|---|---|
TimeAnimator() |
|
公共方法(Public methods) |
|
|---|---|
void |
setCurrentPlayTime(long playTime) 将动画的位置设置为指定的时间点。 |
void |
setTimeListener(TimeAnimator.TimeListener listener) 设置在动画生命周期中发送更新事件的侦听器。 |
void |
start() 开始这个动画。 |
继承方法(Inherited methods) |
|
|---|---|
android.animation.ValueAnimator
|
|
android.animation.Animator
|
|
java.lang.Object
|
|
void setCurrentPlayTime (long playTime)
将动画的位置设置为指定的时间点。 这个时间应该在0到动画的总持续时间之间,包括任何重复。 如果动画还没有开始,那么在它被设置到这个时间之后它不会前进; 它会简单地将时间设置为该值并根据该时间执行任何适当的操作。 如果动画已经在运行,则setCurrentPlayTime()会将当前播放时间设置为此值,并从该点继续播放。
| 参数(Parameters) | |
|---|---|
playTime |
long: The time, in milliseconds, to which the animation is advanced or rewound. |
void setTimeListener (TimeAnimator.TimeListener listener)
设置在动画生命周期中发送更新事件的侦听器。
| 参数(Parameters) | |
|---|---|
listener |
TimeAnimator.TimeListener: the listener to be set. |
void start ()
开始这个动画。 如果动画具有非零的startDelay,则动画将在延迟消逝后开始运行。 非延迟动画将立即设置其初始值,然后调用onAnimationStart(Animator)以供该动画师的任何听众使用。
通过调用此方法开始的动画将在调用此方法的线程上运行。 这个线程应该有一个Looper(如果不是这种情况,将会抛出一个运行时异常)。 此外,如果动画会为视图层次结构中的对象的属性制作动画,则调用线程应该是该视图层次结构的UI线程。