I. Defining animations
1. Enter the animation
<?xml version= "1.0" encoding= "Utf-8"? ><set xmlns:android= "Http://schemas.android.com/apk/res/android" > <translate android:duration= "android:fromxdelta=" -100%p " android:toxdelta=" 0 "> </translate></set>
2. Exit animation
<?xml version= "1.0" encoding= "Utf-8"? ><set xmlns:android= "Http://schemas.android.com/apk/res/android" > <translate android:duration= "android:fromxdelta=" 0 " android:toxdelta=" 100%p "> </translate></set>
Second, the use of animation
Prev Button response Event public void Previous (View viwe) { startactivity (new Intent (This,setup1activity.class)); Finish (); Overridependingtransition (r.anim.tran_previous_in,r.anim.tran_previous_out); }
Note: overridependingtransition (r.anim.tran_previous_in,r.anim.tran_previous_out); must be after startactivity or finish
Transferred from: http://mzh3344258.blog.51cto.com/1823534/807337
- /**
- * The following official explanation of this method is as follows, the version from 2.0 onwards OH
- * Call immediately after one of the flavors of startactivity (Intent) or finish ()
- * To specify a explicit transition animation to perform next.
- * Use tool to find explanations as follows:
- * After the invocation of StartActivity (Intent) or finish (), a specified XML file describing the animation is immediately executed
- * Next Activity
- *
- * The following two sentences are explanations of the method's two parameters, before which the pony also looked at what others were saying,
- * In fact, it is wrong to see the official explanation is certainly true, do not understand the use of English tools to check
- * Pony always said, my English sucks, I can check you must also be able to find
- * 1.enterAnim A Resource ID of the animation resource
- * To use for the incoming activity. Use 0 for no animation.
- * 2.exitAnim A Resource ID of the animation resource
- * To use for the outgoing activity. Use 0 for no animation.
- * One: Enter animation an animated resource, used to animate when the target activity enters the screen, where 0 means no animation
- * Two: Exit animation an animation resource used to animate the current activity when exiting the screen, where writing 0 means no animation
- *
- * This goal, how to understand now? For example: StartActivity (A (current)--B (target)) "Finish ()"
- * One of the following parameters is 0, which means no animation when a exits ... Be sure to figure out the parameters, or the animation will be dizzy.
- * Overridependingtransition (r.anim.zoom_enter, 0);
- * Method two parameters corresponding to the target, the current activity, as shown in the green diagram below the effect
- */
Activity Jump Animation