There are two ways in which animation can be toggled between pages in Android, one is code, and the other is defined to modify activity Theme.
First, the code implementation is relatively simple
You can modify the activity's toggle animation in real time by calling Overridependingtransition ().
Note, however, that the function must be called immediately after calling StartActivity () or finishe, and only once.
Two. Activity Theme
1. Enter the following code in Styles.xml:
<style name= "animationactivity" parent= "@android: style/animation.activity" >
<item name= "Android:activityopenenteranimation" > @anim/fade_right_in</item>< when a new page is opened, Animations performed by new activity-- <item name= "android:activityopenexitanimation" > @anim/fade_left_out</item > <!--When a new page is opened, the old activity performs the animation-- <item name= "android:activitycloseenteranimation" > @anim/fade_ left_in</item><!--The current page is closed, the underlying activity performs the animation-- <item name= "Android: Activitycloseexitanimation "> @anim/fade_right_out</item>< the current activity is animated when the current page is closed!-- </style>
2. Then in the Themes.xml
<style name= "themeactivity" > <item name= "Android:windowanimationstyle" > @style/animationactivity </item> <item name= "Android:windownotitle" >true</item> </style>
3. Specify theme for activity in Androidmanifest.xml.
<activity android:name= "com.example.activityanimation.SecendActivity" android:theme= "@style/themeactivity"/ >
Source:
http://download.csdn.net/detail/duanyu218/7451735