Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Basically, Animation is a method in which pictures are manipulated to appear as moving images. In our use case in android, the animation is giving motion to views in order to improve user experience.
Let’s start with an example of a simple rotation animation on a view
Here, we have called the animate() function which is by default present in the View class. The above code animates the view by 360 degrees for 300 ms.
Let’s see another example of an animation where we will change the image of the view.
In the first step, we will create an animation list drawable file(rocket_thrust.xml):
Then on a button click, we are going to perform the animation:
Here, on a button click animation gets started and works till the duration mentioned in the drawable file. In the drawable file, we have set the oneshot attribute as true this will only perform the animation only for one cycle otherwise it animates till stopped.
We can also reposition a view on the screen with the help of ObjectAnimator API. The ObjectAnimator API provides an easy way to move a view in a specified time. Below is an example of the same:
This example will move the view 200 pixels horizontally from the current location in 1 second.
In this way, we can create multiple animations in the app.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.