Monday, February 5, 2018

Animations in Android

Animations in Android


Animation in android is possible from many ways. In this chapter we will discuss one easy and widely used way of making animation called tweened animation.

Android provides a large number of classes and interface for the animation development. Most of the classes and interfaces are given in android.animation package.
Android Animation enables you to change the object property and behavior at run time. There are various ways to do animation in android.

Tween Animation

Tween Animation takes some parameters such as start value , end value, size , time duration , rotation angle e.t.c and 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. Its syntax is as follows −

Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), 
   R.anim.myanimation);
Tweened animations are commonly used to:
➤ Transition between Activities.
➤ Transition between layouts within an Activity.
➤ Transition between different content displayed within the same View.
➤ Provide user feedback such as:
➤ Indicating progress.
➤ ‘‘Shaking’’ an input box to indicate an incorrect or invalid data entry.

No comments:

Post a Comment