Animation capability in Android and how to create them
3 minute(s) read
|
Published on: Apr 28, 2021
Updated on: Dec 14, 2021
|
The addition of new features and capabilities increases the use of the operating system and improves their performance. For example, in version 3.0, the Android operating system supports dynamic views and has the ability to display them. As the version of operating systems increases, other new features are added to them. Dynamics allows users to easily identify object properties over specific time periods and modify them as needed. In this tutorial, we will talk about different types of dynamic display capabilities in the Android operating system.
The API allows the programmer to set a start value and an end value for the object properties at specified intervals and can also apply timing changes to the attribute. It should be noted that this API can be used for different types of objects and is not intended only for views.
The parent class, also known as the superclass, is also the Animation API of the Animator class. The ObjectAnimator class is used to define and modify the properties of objects.
It is also possible for the programmer to add an AnimatorListener class to the Animator senior class. Listener can also be called in the animation and animation stages.
ViewPropertyAnimator
It should be noted that using the ViewPropertyAnimator class, which first appeared in version 3.1 of the Android operating system, can access the animations that exist at the view level.
The ViewPropertyAnimator object in a view can be returned by the animate () function. This object can enable animations to be performed simultaneously. It also has an API that enables the programmer to set the animation time.
The task of the ViewPropertyAnimator class is to provide an API for dynamic views.
The code below shows its use.
setInterpolator () allows you to create a TimeInterpolator object. The standard procedure in this section is linear. In this AccelerateDecelerateInterpolator, the speed is initially low and increases slightly in the middle and then decreases again at the end.
Enable the LayoutTransition class on layout changes.
Like the following:
view animation
In this section, we will tell you how to use the Properties Animation API.
1- a new project called com. vogella. android. animation. views.
2- It is better to new a project with an activity called AnimationExampleActivity.
3- The layout file name should be main.xml.
4- Change the said file like the codes inserted below.
5- a menu resource.
6- Change the Activity like the codes inserted below.
7- a new activity called HitActivity.
The animation should begin after you have carefully completed the steps listed above. To do this, you can access the navigation activity through the ActionBar.
About our Android and iOS app development services