In the development of property animation is a very common function, below I put the basic usage of property animation record for others to learn, but also gradually accumulate their knowledge.
Single animation effect:
1 // 2 3 objectanimator animator= Objectanimator.offloat (TextView, "TextSize", "a", "15 5 // The time it takes to animate is automatically smoothed by the world 6 7 animator.setduration (6000 9 // animation start 10 11 Animator.start ();
Combining animation effects:
1 //after (Animator anim) inserts an existing animation into the incoming animation after it executes2 3 //after (long delay) The existing animation is delayed by a specified millisecond after execution4 5 //before (Animator Anim) executes an existing animation before inserting it into an incoming animation6 7 //with (Animator Anim) performs both existing and incoming animations8 9 //The animation object is created, followed by the following parameters: The target component of the animation effect, the properties of the build that need to be changed (must have the corresponding get and set methods to be able), the following three parameters write the process corresponding to the value. Ten OneObjectanimator animator1= objectanimator.offloat (TextView, "TextSize", 15, 50, 15); A - //This is where you get the angle of the target view first. - the floatinit =textview.getrotation (); - - //rotation, the same reason - +Objectanimator Animator2 = objectanimator.offloat (TextView, "rotation", init,init+180f); - + //translation, the same reason A atObjectanimator Animator3 = objectanimator.offloat (TextView, "Translationx", curtranslationx,-500f,curtranslationx); - - //set the class of the animation combination - -Animatorset animatorset=NewAnimatorset (); - in //Set 3 animations how to mix and match - to Animatorset.play (Animator2). with (Animator1). After (Animator3); + - //The time it takes for the animation process to be automatically smoothed by the world the *Animatorset.setduration (6000); $ Panax Notoginseng //Animation Start - theAnimatorset.start ();
To increase the listener for the animation:
1 //here is the listener for the animation, the implementation of which method according to the needs of the choice can be, such as: the completion of the animation, animation execution begins, animation execution cancellation, animation repeat action and so on. 2 3Animatorset.addlistener (NewAnimatorlisteneradapter () {4 5 //This is where you need to implement the specific content you want to perform.6 7 @Override8 9 Public voidonanimationend (Animator animation) {Ten One Super. Onanimationend (animation); A - } - the});
Above. In addition to the online full range of security, compatibility test for the app, I will use this: www.ineice.com.
Basic usage of property animations in Android