Developed on Android. We often use zoom animations, and there are two ways to scale animations in normal situations. One is directly through the Java code to implement, the second is to implement the animation through the configuration file, the following is the basic use of the two animations:
Java Code Implementation:
Create a scaled animation object animation animation = new Scaleanimation (0, 1.0f, 0f, 1.0f); animation.setduration (1500);// Animation time Animation.setrepeatcount (3);//animation repeats the number of times animation.setfillafter (TRUE);//set to True, After the animation conversion is applied imageview1.startanimation (animation);//Start animation
through the configuration file implementation:
1, first to create a Anim file under the Res folder, in Anim to establish a scale.xml file such as the following:
<?xml version= "1.0" encoding= "Utf-8"? ><set xmlns:android= "Http://schemas.android.com/apk/res/android" > <scale android:duration= "android:fillafter=" true " android:fromxscale=" 0.0 " android:fromyscale= "0.0" android:interpolator= "@android: Anim/accelerate_decelerate_interpolator" android:pivotx= "0%" android:pivoty= "50%" android:toxscale= "1.0" android:toyscale= "1.0" / ></set>
2. Loading animation:
Animation Animation = Animationutils.loadanimation (this, r.anim.scale); Imageview1.startanimation (Animation);//Start animation
Case:http://download.csdn.net/detail/u013043346/9374204
Two ways to implement Android zoom animation