Android implementation activity page jump Toggle animation effect

Source: Internet
Author: User

People who know about Android programming should know that after Android 2.0 there is a overridependingtransition () with two parameters, one for the previous activity, and another for the activity entry.

The following code:

@Override Public voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);     Setcontentview (R.layout.splashscreen); NewHandler (). postdelayed (NewRunnable () {@Override Public voidrun () {Intent mainintent=NewIntent (SplashScreen. This, Androidnews.class); SplashScreen. This. StartActivity (mainintent); SplashScreen. This. Finish ();      Overridependingtransition (r.anim.zoomin,r.anim.zoomout); }     }, 3000); } 

First, create the Anim folder under the Res folder, and then put the animated XML file inside.

Zoomin.xml

<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android"Android:interpolator= "@android: Anim/decelerate_interpolator">    < Scaleandroid:duration= "@android: Integer/config_mediumanimtime"Android:fromxscale= "2.0"Android:fromyscale= "2.0"Android:pivotx= "50%p"Android:pivoty= "50%p"Android:toxscale= "1.0"Android:toyscale= "1.0" /></Set>

Zoomout.xml

<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android"Android:interpolator= "@android: Anim/decelerate_interpolator"android:zadjustment= "Top">    < Scaleandroid:duration= "@android: Integer/config_mediumanimtime"Android:fromxscale= "1.0"Android:fromyscale= "1.0"Android:pivotx= "50%p"Android:pivoty= "50%p"Android:toxscale= ". 5"Android:toyscale= ". 5" />    <Alphaandroid:duration= "@android: Integer/config_mediumanimtime"Android:fromalpha= "1.0"Android:toalpha= "0" /></Set>

Android implementation activity page jump Toggle animation effect

Related Article

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.