Method one overridependingtransition (0,0)
void android.app.Activity.overridePendingTransition (int enteranim, int exitanim) call immediately after one of the Flavors of startactivity (Intent) or finish to specify a explicit transition animation to perform next. Parameters:enteranim A Resource ID of the animation resource to use for the incoming activity. Use 0 for no Animation.exitanim A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation.
The overridependingtransition function is provided in the activity,used after startactivity (Intent) and finish. Overridependingtransition has two parameters, all of which are of type int, meaning that a resource is passed in here. One is to enter the animation, one is to exit the animation, if the value is set to 0, it means not to add animation.
Examples of animationdrable resources:
<?xml version= "1.0" encoding= "utf-8"?><!--slide-in--><set xmlns:android= "http://schemas.android.com/ Apk/res/android "> <translate android:duration=" android:fromxdelta= "100%p" android: Toxdelta= "0"/> <alpha android:duration= "" android:fromalpha= "0.0" android:toalpha= " 1.0 "/></set>
or consider using Android with an animated resource directly from Android. r.anim.*Method Two Android:theme
<style name= "Themeactivity" mce_bogus= "1" > <item name= "Android:windowanimationstyle" > @style/ activityanimation</item> <item name= "Android:windownotitle" >true</item> </style > <style name= "Activityanimation" mce_bogus= "1" parent= "@android: style/animation.activity" > < Item Name= "Android:activityopenenteranimation" > @anim/anim_enter</item> <item name= "Android: Activityopenexitanimation "> @anim/anim_exit</item> <item name=" Android: Activitycloseenteranimation "> @anim/back_enter</item> <item name=" Android: Activitycloseexitanimation "> @anim/back_exit</item> </style>
parent= "@android: style/animation.activity" is not rare,
<item name= "Android:windownotitle" >true</item> optional.
Use of Android:theme
<activity android:name= "com.tpx.androiddemo.SecondActivity" android:label= "@string/title_activity_ Second " android:theme=" @style/themeactivity "> </activity>
Two ways to switch animations for Android activity