1. Set Rotation animation
Final rotateanimation animation =new rotateanimation (0f,360f,animation.relative_to_self, 0.5f,animation.relative_to _self,0.5f);
Animation.setinterpolator (New Linearinterpolator ()); The linearinterpolator represents a uniform rate of animation.setduration (3000);//Set animation duration animation.setrepeatcount (animation.infinite); Repeat multiple times, can also use specific number of times ll_earn_circle_bg.startanimation (animation); LL_EARN_CIRCLE_BG is a linearlayout control
2. Set displacement animation
/*** Cycletimes The number of repetitions of animation *@paramCycletimes*/ Public voidShakeanimation (intcycletimes) { if(NULL==mshakeanimation) {mshakeanimation=NewTranslateanimation (0, 10, 0, 0); Mshakeanimation.setinterpolator (NewCycleinterpolator (Cycletimes));//set the speed, cycleinterpolator some sort of mathematical curve, that is, the rate of shaking is curvedMshakeanimation.setduration (1500); Mshakeanimation.setrepeatmode (animation.reverse);//set the reverse direction of execution} tv_curmoney.startanimation (mshakeanimation); Tv_curmoney is a TextView control}
3. Set the Zoom animation
/*** /final scaleanimation animation =new scaleanimation (0.0f, 1.0f, 0.0f, 1.0f, Animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); Animation.setduration (2000); // Iv_go_rank is a ImageView control
Introduction to Rates:
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.
Android Background Code settings animation