Для этого кода:< /p>
Код: Выделить всё
valueAnimator = ValueAnimator.ofInt(0, 10);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final int currentValue = (int) animation.getAnimatedValue();
if (lastAnimationValue == currentValue)
return;
Log.v("swifter", this + " onAnimationUpdate currentValue = " + currentValue);
}
});
valueAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationRepeat(Animator animation) {
Log.d("swifter", this + " onAnimationRepeat...");
}
});
valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
valueAnimator.setDuration(1000);
valueAnimator.start();
Код: Выделить всё
......
onAnimationUpdate currentValue = 8
onAnimationUpdate currentValue = 9
onAnimationUpdate currentValue = 10
onAnimationRepeat...
onAnimationUpdate currentValue = 0
onAnimationUpdate currentValue = 1
......
Код: Выделить всё
......
onAnimationUpdate currentValue = 8
onAnimationUpdate currentValue = 9
onAnimationRepeat...
onAnimationUpdate currentValue = 10
onAnimationUpdate currentValue = 0
onAnimationUpdate currentValue = 1
......
Так работает ValueAnimator? если нет, то как заставить его работать так, как я хочу?
Подробнее здесь: https://stackoverflow.com/questions/791 ... -execution
Мобильная версия