Reputation: 897
I'm trying to create an animation for a TextView where the numbers decrease/increase like this:
How would I do something like this? Is there a library that anyone knows of?
Upvotes: 1
Views: 678
Reputation: 897
Using ValueAnimator:
private void startCountAnimation() {
ValueAnimator animator = ValueAnimator.ofInt(0, 600);
animator.setDuration(5000);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
textView.setText(animation.getAnimatedValue().toString());
}
});
animator.start();
}
https://stackoverflow.com/a/29443935/11628353
Upvotes: 1