What is Android Animation?
- Animation is the process of creating motion and shape change.
- Animation in android is possible from several ways.
- One easy and broadly used way of creating animation called tweened animation.
What is Tweened Animation?
- Tween Animation takes some parameters such as start value, end value, size, time duration, rotation angle etc. & perform the required animation on that object.
- It can be applied to any type of object. So in order to use this, android has provided us a class called Animation.
- In order to perform animation in android, we are going to call a static function loadAnimation() of the class AnimationUtils.
- We are going to receive the result in an instance of Animation Object.
Android Animation Example
- Android offers you a huge number of classes & interface for the animation development.
- Most of the classes & interfaces are given in android.animation package.
- Android Animation enables you to change the object property and behavior at run time. There are many ways to do animation in android.
- The AnimationDrawable class provides methods to start & end the animation. Even, you can use time based animation.
activity_main.xml / wikitechy_main.xml
- You need to have a view only.
- File: activity_main.xml / wikitechy_main.xml
- File: logo.xml
- Have a image view only.
- You need to create animation.xml file inside res/drawable-hdpi directory.
- You need to have several images. Here, we are using 14 images & all the 14 images are placed inside res/drawable-mdpi directory.
- File: animation.xml