One: The entire app has fade effect 1: Define an animation file under the Anim folder
Accelerate_interpolator.xml
<span style= "FONT-SIZE:14PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><accelerateinterpolator/></span>
Decelerate_interpolator.xml
<span style= "FONT-SIZE:14PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><decelerateinterpolator/></span>
Fade_in.xml
<span style= "FONT-SIZE:14PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><alpha xmlns:android= "http://schemas.android.com/apk/res/ Android " android:duration=" @android: Integer/config_longanimtime " android:fromalpha=" 0.0 " android: Interpolator= "@anim/decelerate_interpolator" android:toalpha= "1.0"/></span>
Fade_out.xml
<span style= "FONT-SIZE:14PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><alpha xmlns:android= "http://schemas.android.com/apk/res/ Android " android:duration=" @android: Integer/config_mediumanimtime " android:fromalpha=" 1.0 " Android : interpolator= "@anim/accelerate_interpolator" android:toalpha= "0.0"/></span>
2: Define Styles.xml file
<span style= "FONT-SIZE:14PX;" ><resources xmlns:android= "Http://schemas.android.com/apk/res/android" > <style name= " Appbasetheme "parent=" Android:Theme.Light "></style> <style name=" Apptheme "parent=" Appbasetheme " > <item name= "Android:windowanimationstyle" > @style/myanimation</item> </style> <style name= "myanimation" parent= "@android: style/animation.activity" > <item name= "Android: Activityopenenteranimation "> @anim/fade_in</item> <item name=" Android:activityopenexitanimation " > @anim/fade_out</item> <item name= "android:activitycloseenteranimation" > @anim/fade_in</ item> <item name= "android:activitycloseexitanimation" > @anim/fade_out</item> </style ></resources></span>
3. Configure the theme under configuration files
<span style= "FONT-SIZE:14PX;" ><application android:allowbackup= "true" android:icon= "@drawable/ic_launcher" android:label= "@string/app_name" android:theme= "@style/apptheme" > <activity android:name= " Com.union.foodunion.WelcomeActivity " android:label=" @string/app_name "> <intent-filter> <action android:name= "Android.intent.action.MAIN"/> <category android:name= " Android.intent.category.LAUNCHER "/> </intent-filter> </activity></application> </span>
Two: single page with fade effectdefine the animation file under the Anim folder (IBID.), then add the code after finish () or startactivity () in actiivty:
<span style= "FONT-SIZE:14PX;" >overridependingtransition (r.anim.fade_in, R.anim.fade_out);</span>