Android Animators ViewPropertyAnimator

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

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.



Got any Android Question?