Ich konnte nicht verstehen, warum meine benutzerdefinierten Animationen die Systemanimationen nicht überschreiben, wenn ich zwischen den Aktivitäten in meiner App wechsle.Android: Aktivitätenanimationen funktionieren nicht
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" />
Manifest:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
Mit all diesen Sets hoffte ich, verblassende Animationen zu sehen, aber das passiert überhaupt nicht.
FYI, bemerkte ich, wenn ich android:windowEnterAnimation
und android:windowExitAnimation
statt und erhöhen Wert von android:duration
zu so etwas wie 2000
in Animationen Dateien verwenden, dann sehr langsam verblassen Animationen Ich sehe aber ich habe wollen Animationen in allen vier Fällen und schneller Schwund.
Ich verwende Kitkat 4.4.2. Danke für Ihre Hilfe
Ich möchte nicht diese sich wiederholende Arbeit vor dem Start activiteis tun, deshalb habe ich verwendet, Stile, so dass alle Aktivitäten gleichen Stil erhalten, ohne Java-Code zu schreiben. – Dev01
Auch wenn Sie Styles verwenden, müssen Sie jedes Mal diesen Code schreiben. Dies ist noch weniger Arbeit, als OverridePendingTransitions mit bestimmten Animationen zu spezifizieren, da die Animation aus Ihren XML-Dateien übernommen wird –