In this Blog, we will learn about using some more simple animations in your android application.
For Checking what this blog is all about, please scroll to the end of the blog, there you will see a sample gif demo of animations covered in this blog.
Well, the content in this blog is in addition to my previous blog, so if you don’t get to understand something, please read this blog first.
In this blog, I have just added two more Simple Animations to my collection.
APPROACH :
In the”res” folder of your project, create a new folder and name it “anim”.
You need to create an xml file in which you will write the code for your animation.
Get the object of the view in your activity/fragment.
Call the startAnimation() method on the view. This method call requires you to send an object of animation in params.
You can either create a new animation object and assign it the value returned by AnimationUtils.loadAnimation()method or directly pass the AnimationUtils.loadAnimation() method in the method used in step4.
The AnimationUtils.loadAnimation() method takes two parameters: the first one is the Context, second one is the id of your xml file in which the animation is set. You need to pass the resourceId of the file you created in step2 (something like R.anim.your_file_name)
“…” is animating using”my_custom_animation_horizontal_loading” animation and the image is using “my_custom_animation_circular_loading” animation in the gif below.
A dynamic developer specializing in Flutter, Dart, and React Native. Delivers high-performance Android and iOS apps with intuitive designs, scalability, and seamless cross-platform integration.
Be the first to comment.