如何实现在5秒开的TextView在Android从0越来越多的动画600 [英] How to implement increasing number animation from 0 to 600 in 5 secs on TextVIew on android
本文介绍了如何实现在5秒开的TextView在Android从0越来越多的动画600的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
家伙,
我打算实施与某些秒内动画一些价值上的TextView整数增加,从0。
例如显示动画从而增加从0到600上的TextView 5秒的持续时间。
guys, I plan to implement integer number increase on textView from 0 to some value with animation within certain seconds. e.g show animation which increase number from 0 to 600 on textview for 5 seconds duration.
我怎样才能实现呢?
在此先感谢!
推荐答案
您可以使用 ValueAnimator 一>为:
private void startCountAnimation() {
ValueAnimator animator = new ValueAnimator();
animator.setObjectValues(0, 600);
animator.setDuration(5000);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
textView.setText("" + (int) animation.getAnimatedValue());
}
});
animator.start();
}
这篇关于如何实现在5秒开的TextView在Android从0越来越多的动画600的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文