Overridependingtransition animation effect when activity is switched

Source: Internet
Author: User

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
    1. Intent Intent = new Intent (firstactivity. This, secondactivity.     class);
    2. Startactivityforresult (Intent, 11);



Add interface Toggle effect, note that only Android 2.0 (sdkversion version number 5) Later versions are supported

[HTML]View Plaincopy
    1. int Version = integer.valueof (Android.os.Build.VERSION.SDK);
    2. if (version >= 5) {
    3. Overridependingtransition (R.anim.zoomin, r.anim.zoomout); This is a custom animation effect, with the following two animated effects for the system
    4. Overridependingtransition (Android. R.anim.fade_in,android. R.anim.fade_out);
    5. Overridependingtransition (Android. R.anim.slide_in_left,android. R.anim.slide_out_right);
    6. }


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

1, animation entry effect: Zoomin.xml

[HTML]View Plaincopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <set xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:interpolator="@android: Anim/decelerate_interpolator">
  4. <scale android:fromxscale= "2.0" android:toxscale="1.0 "
  5. android:fromyscale= "2.0" android:toyscale="1.0 "
  6. android:pivotx= "50%p" android:pivoty="50%p "
  7. android:duration="@android: Integer/config_mediumanimtime" />
  8. </Set>


2, animation exit effect: Zoomout.xml

[HTML]View Plaincopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <set xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:interpolator="@android: Anim/decelerate_interpolator"
  4. android:zadjustment="Top">
  5. <scale android:fromxscale="1.0" android:toxscale= ". 5"
  6. android:fromyscale= "1.0" android:toyscale= ". 5"
  7. android:pivotx= "50%p" android:pivoty="50%p "
  8. android:duration="@android: Integer/config_mediumanimtime" />
  9. <Alpha android:fromalpha= "1.0" android:toalpha="0"
  10. android:duration="@android: Integer/config_mediumanimtime"/>
  11. </Set>

Overridependingtransition animation effect when activity is switched

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.