Zoomin animation falls under the category of View Animation. The view animation framework animations, which can both be declared in XML.
The zoomin animation xml file is given below:
<scale android:fromXScale=“2.0” android:toXScale=“1.0”
•<set> contains other animation elements.
•<scale > is a resizing animation tag. You can specify the center point of the image from which it grows outward (or inward) by specifying pivotX and pivotY.
•fromXScale/fromYScale represents the initial state and toXScale/toYScale represent the final state .
Hence , in this example the image is zoomed to its double size as “1.0” scale specifies no change.
Note: The zoomin.xml is created in anim folder which is a part of res folder.
The code for loading and starting the animation is given below.
public void onItemClick( View v)
Animation animLinear = AnimationUtils.loadAnimation(mContext, R.anim.zoomin);
v.startAnimation(animLinear);//starts the animation
android.view.animation.AnimationUtils defines common utilities for working with animations and loadAnimation loads an animation object from a resource anim folder.
Hence ,create the animation xml file first and then add the above code.