Activity Jump Animation

Source: Internet
Author: User

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

  1. /** 
  2. * The following official explanation of this method is as follows, the version from 2.0 onwards OH
  3. * Call immediately after one of the flavors of startactivity (Intent) or finish ()
  4. * To specify a explicit transition animation to perform next.
  5. * Use tool to find explanations as follows:
  6. * After the invocation of StartActivity (Intent) or finish (), a specified XML file describing the animation is immediately executed
  7. * Next Activity
  8. *
  9. * The following two sentences are explanations of the method's two parameters, before which the pony also looked at what others were saying,
  10. * In fact, it is wrong to see the official explanation is certainly true, do not understand the use of English tools to check
  11. * Pony always said, my English sucks, I can check you must also be able to find
  12. * 1.enterAnim A Resource ID of the animation resource
  13. * To use for the incoming activity. Use 0 for no animation.
  14. * 2.exitAnim A Resource ID of the animation resource
  15. * To use for the outgoing activity. Use 0 for no animation.
  16. * One: Enter animation an animated resource, used to animate when the target activity enters the screen, where 0 means no animation
  17. * Two: Exit animation an animation resource used to animate the current activity when exiting the screen, where writing 0 means no animation
  18. *
  19. * This goal, how to understand now? For example: StartActivity (A (current)--B (target)) "Finish ()"
  20. * 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.
  21. * Overridependingtransition (r.anim.zoom_enter, 0);
  22. * Method two parameters corresponding to the target, the current activity, as shown in the green diagram below the effect
  23. */

Activity Jump Animation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.