1.
//the following effect is to shift the title bar titlebar up the distance of its height, that is, hide//Each two is a set of parameters, relative to the X start, x end, y start, and Y end of the control itselfTranslateanimation translate =Newtranslateanimation (animation.relative_to_self,0, Animation.relative_to_self,0, Animation.relative_to_self,0, Animation.relative_to_self,-1.0f); //set How many times the animation executes, and if it is 1, repeat it all the time.Translate.setrepeatcount (Animation.infinite); ; //Set repeat mode, restart to start again, reverse to return as the original trajectoryTranslate.setrepeatmode (Animation.restart); Translate.setduration (1000);//millisecond Unit, 5s//when set to True, the interface stays on the screen when the animation finishes playing. Translate.setfillafter (true); Titlebar.startanimation (translate);
2, about acceleration deceleration execution animation
//set the access mode of the target based on the user's choice of spinner Switch(position) { Case0: //Accelerated AccessA.setinterpolator (Animationutils.loadinterpolator ( This, Android. R.anim.accelerate_interpolator)); Break; Case1: //deceleration intoA.setinterpolator (Animationutils.loadinterpolator ( This, Android. R.anim.decelerate_interpolator)); Break; Case2: //accelerated entry. The difference from the first is that when Repeatmode is reverse, the return origin is still acceleratedA.setinterpolator (Animationutils.loadinterpolator ( This, Android. R.anim.accelerate_decelerate_interpolator)); Break; Case3: //Go back a little bit and speed it up .A.setinterpolator (Animationutils.loadinterpolator ( This, Android. R.anim.anticipate_interpolator)); Break; Case4: //slow down, go back before you finish.A.setinterpolator (Animationutils.loadinterpolator ( This, Android. R.anim.overshoot_interpolator)); Break; Case5: //Case 3,4 's binding bodyA.setinterpolator (Animationutils.loadinterpolator ( This, Android. R.anim.anticipate_overshoot_interpolator)); Break; Case6: //stop coming back to the vibration a fewA.setinterpolator (Animationutils.loadinterpolator ( This, Android. R.anim.bounce_interpolator)); Break; }
done!
Translateanimation panning Animations