Note that the toggle method overridependingtransition can only be called after the StartActivity and finish methods.
The first parameter is the animation of the first activity leaving, and the second parameter is the animated effect of the entered activity
Fade effect
Overridependingtransition (R.anim.fade, r.anim.hold);
Magnify fade-out effect
Overridependingtransition (r.anim.my_scale_action,r.anim.my_alpha_action);
Turn fade-out effect
Overridependingtransition (r.anim.scale_rotate,r.anim.my_alpha_action);
Turn fade-out effect
Overridependingtransition (r.anim.scale_translate_rotate,r.anim.my_alpha_action);
Top left corner expand fade out effect
Overridependingtransition (r.anim.scale_translate,r.anim.my_alpha_action);
Compression fade out effect
Overridependingtransition (r.anim.hyperspace_in,r.anim.hyperspace_out);
Right to left launch effect
Overridependingtransition (r.anim.push_left_in,r.anim.push_left_out);
Bottom-up rollout effect
Overridependingtransition (r.anim.push_up_in,r.anim.push_up_out);
Left and right interleaving effect
Overridependingtransition (R.anim.slide_left,r.anim.slide_right);
Magnify fade-out effect
Overridependingtransition (r.anim.wave_scale,r.anim.my_alpha_action);
Reduce effect
Overridependingtransition (R.anim.zoom_enter,r.anim.zoom_exit);
Up and down interleaving effect
Overridependingtransition (r.anim.slide_up_in,r.anim.slide_down_out);
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.
When two activity jumps, customize the page flipping effect:
[Java]View Plaincopy
- 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
[HTML]View Plaincopy
- int Version = integer.valueof (Android.os.Build.VERSION.SDK);
- if (version >= 5) {
- Overridependingtransition (R.anim.zoomin, r.anim.zoomout); This is a custom animation effect, with the following two animated effects for the system
- Overridependingtransition (Android. R.anim.fade_in,android. R.anim.fade_out);
- Overridependingtransition (Android. R.anim.slide_in_left,android. R.anim.slide_out_right);
- }
The following is a two custom animation effects XML file, stored in: res/anim/
1, animation entry effect: Zoomin.xml
[HTML]View Plaincopy
- <? XML version= "1.0" encoding="Utf-8"?>
- <set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android: Anim/decelerate_interpolator">
- <scale android:fromxscale= "2.0" android:toxscale="1.0 "
- android:fromyscale= "2.0" android:toyscale="1.0 "
- android:pivotx= "50%p" android:pivoty="50%p "
- android:duration="@android: Integer/config_mediumanimtime" />
- </Set>
2, animation exit effect: Zoomout.xml
[HTML]View Plaincopy
- <? 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>
Overridependingtransition animation effect when activity is switched