ViewPropertyAnimator
is a simplified and optimized way to animate properties of a View
.
Every single View
has a ViewPropertyAnimator
object available through the animate()
method. You can use that to animate multiple properties at once with a simple call. Every single method of a ViewPropertyAnimator
specifies the target value of a specific parameter that the ViewPropertyAnimator
should animate to.
View exampleView = ...;
exampleView.animate()
.alpha(0.6f)
.translationY(200)
.translationXBy(10)
.scaleX(1.5f)
.setDuration(250)
.setInterpolator(new FastOutLinearInInterpolator());
Note: Calling start()
on a ViewPropertyAnimator
object is NOT mandatory. If you don't do that you're just letting the platform to handle the starting of the animation in the appropriate time (next animation handling pass). If you actually do that (call start()
) you're making sure the animation is started immediately.