Which Android Animator to Use?
A guide to deciding which Animator class you need
Published in
7 min readJun 7, 2020
Android provides us with an Animator
class, which consists of a great set of functionality classes allowing us to perform any animations on our view.
Many of them do similar things, which makes it hard for us to choose. Here, I provide a simple guide on selecting according to your needs.
1. Use ViewPropertyAnimator for Simple Animation
If you plan to animate just one view, with basic animations, and you don’t plan to repeat it, just use ViewPropertyAnimator
.
txt_animate.animate().apply {
rotationX(3600f)
duration = 5000
interpolator = AccelerateDecelerateInterpolator()
}.start()
Use this approach if you want a most concise animation as you don’t need to instantiate any Animator object yourself.
However, it has limitations:
- The animation can’t be repeated.
- You only have an end value to animate to and no start value.
- Only basic animations are available to the
animate
…