Animationset can join animation and set Animationset to be valid for all animation to join.
[Java]View Plaincopy
- Animationset anim=New Animationset (true);
- Alphaanimation a=New Alphaanimation (1,0);
- Rotateanimation ra=New Rotateanimation (0, 720, animation.relative_to_self,0.5f, animation.relative_ To_self,0.5f);
- Anim.addanimation (a);
- Anim.addanimation (RA);
- Anim.setduration (3000);
- Anim.setstartoffset (1000);
- Iv.startanimation (ANIM);
Multiple animation can be defined in the XML file so that multiple animation can be run together
[HTML]View Plaincopy
- <? XML version= "1.0" encoding="Utf-8"?>
- <set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android: Anim/accelerate_interpolator"
- android:shareinterpolator="true"
- >
- <Alpha
- android:fromalpha="1.0"
- android:toalpha="0.0"
- android:startoffset="
- android:duration=" the"
- />
- <rotate
- android:fromdegrees="0"
- android:todegrees="The "
- android:pivotx="50%"
- android:pivoty="50%"
- android:duration=" the"
- />
- </Set>
Interpolator can define the speed of animation playback
Defining interpolator in an XML file
Android:interpolator= "@android: Anim/accelerate_interpolator"
Android:shareinterpolator= "true"
So all the animation share a interpolator.
Set the following code in code
Anim.setinterpolator (New Accelerateinterpolator ());
When you pass in new one animationset true, all animation share the interpolator.
Interpolator and Animationset of Android animations