The android.view.View class provides various methods to perform animations on the views. The animate() method enables you to access the ViewPropertyAnimator class that allows you to chain multiple animations together and set various animation properties like duration, interpolator, and listeners.
Example 1: Animate the alpha property of a View to change its transparency gradually.
This code example uses the ViewPropertyAnimator's alpha method to change the view's alpha property to 0.5f (50% opacity). The setDuration() method sets the animation duration to 2000 milliseconds (2 seconds).
Example 2: Animate the translationX and scale properties of a View simultaneously.
This code example uses multiple methods of the ViewPropertyAnimator class to perform two animations simultaneously. The translationX() method changes the view's horizontal position by 200 pixels to the right, while the scaleX() and scaleY() methods increase the view's size by 1.5 times. The setDuration() method sets the animation duration to 2000 milliseconds (2 seconds).
Package library: Android Framework.
Java View.animate - 30 examples found. These are the top rated real world Java examples of android.view.View.animate extracted from open source projects. You can rate examples to help us improve the quality of examples.