Activity Toggle Animation (overridependingtransition)-page flipping effect

Source: Internet
Author: User

Activity's toggle animation refers to the animation that jumps from one activity to another activity.
{It consists of two parts:
Part of the animation when the first activity exits;
Another part when the second activity enters the animation;
After the 2.0 version of Android, there is a function to help us implement this animation. This function is Yoverridependingtransition
J This function has two parameters, one parameter is the animation when the first activity exits, and the other is the animation of the second activity entry.

1. It must be called after the startactivity () or the finish () function to call "
2. It is only available on android2.0 and above   The following attachment is a demo that I downloaded from a different website. The
can help you understand this stuff.

When two activity jumps, customize the page flipping effect:

Intent Intent = new Intent (firstactivity.this, Secondactivity.class);
Startactivityforresult (Intent, 11);
 
//Add interface toggle effect, note that only Android 2.0 (sdkversion version number 5) Later versions are supported   < Span class= "Apple-converted-space" >&NBSP;
int version = integer.valueof (Android.os.Build.VERSION.SDK);      &NBSP;
if (version  >= 5) {      &NBSP;
     Overridependingtransition (R.anim.zoomin, r.anim.zoomout); //This is a custom animation effect, the following two animation effects for the system   &NBSP;
  //overridependingtransition (android. R.anim.fade_in,android. r.anim.fade_out);     &NBSP;
     //overridependingtransition (Android. R.anim.slide_in_left,android. r.anim.slide_out_right);   &NBSP;
}   

The following is a two custom animation effects XML file, stored in: res/anim/

1, animation entry effect: Zoomin.xml

<?xml version= "1.0" encoding= "Utf-8"?>
<set xmlns:android= " http://schemas.android.com/apk/res/android " &NBSP;
        android: Interpolator= "@android: Anim/decelerate_interpolator" >   
    <scale android:fromxscale= "2.0" android:toxscale= "1.0"  &NBSP;
           android: Fromyscale= "2.0" android:toyscale= "1.0"  &NBSP;
            android:pivotx= "50%p" android:pivoty= "50%p"  &NBSP;
           android:duration= "@android: Integer/config_mediumanimtime"/>  &NBSP;
</ set> 

2, animation exit effect: Zoomout.xml

<?xml version= "1.0" encoding= "Utf-8"?>
<set xmlns:android= " http://schemas.android.com/apk/res/android"
Android:interpolator= "@android: Anim/decelerate_interpolator"
android:zadjustment= "Top" >
    <scale android:fromxscale= "1.0" android:toxscale= ". 5"  
Android:fromyscale= "1.0" android:toyscale= ". 5"
android:pivotx= "50%p" android:pivoty= "50%p "
Android:duration= "@android: Integer/config_mediumanimtime"/>
<alpha android:fromalpha= "1.0" android:toalpha= "0"
Android:duration= "@android: Integer/config_mediumanimtime"/>
</set>

Activity Toggle Animation (overridependingtransition)-page flipping effect

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.