我一直不能理解为什么当我在应用程序的活动之间切换时,我的自定义动画不能覆盖系统动画。
styles.xml
<style name="AppBaseTheme" parent="android:Theme.Holo.Light"></style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:buttonStyle">@style/buttonStyle</item>
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
<item name="android:editTextStyle">@style/editTextStyle</item>
<item name="android:windowAnimationStyle">@style/ActivityAnimationStyle</item>
</style>
<!-- activities animation style start -->
<style name="ActivityAnimationStyle" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/fadein</item>
<item name="android:activityOpenExitAnimation">@anim/fadeout</item>
<item name="android:activityCloseEnterAnimation">@anim/fadein</item>
<item name="android:activityCloseExitAnimation">@anim/fadeout</item>
</style>
<!-- activities animation style end -->
fadein.xml:
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromAlpha="0.0"
android:interpolator="@android:anim/anticipate_interpolator"
android:toAlpha="1.0" />
fadeout.xml
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromAlpha="1.0"
android:interpolator="@android:anim/anticipate_interpolator"
android:toAlpha="0.0" />
清单文件:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
所有设置都已完成,我希望看到淡出动画,但根本没有发生。
顺便提一下,我注意到如果我使用android:windowEnterAnimation
和android:windowExitAnimation
,并在动画文件中将android:duration
的值增加到大约2000
,那么我会看到非常缓慢的淡出动画,但我想在所有四种情况下都有动画,并且淡出速度更快。
我正在使用Kitkat 4.4.2。感谢您的帮助。