Android: animation activity not working

I could not understand why my custom animations do not override system animations when I switch between actions in my application.

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" > 

With these settings, I was hoping to see fading animations, but this does not happen at all.

FYI, I noticed that instead of android:windowEnterAnimation and android:windowExitAnimation I use android:windowExitAnimation and increase the value of android:duration by something like 2000 in the animation files, then I see very slow fading animations, but I want the animations in all four cases and faster fading.

I am using Kitkat 4.4.2. Thanks for your help.

+5
source share
3 answers

This usually happened on Android 4.4.2. try it

http://blog.csdn.net/xuewater/article/details/36398803

+4
source

As far as I remember, if you want to use trasitions defined in themes, you need to change actions using

startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this).toBundle());

0
source

Unlike the PHP , Javascript or C# communities, the Android community is very calm, there are no answers, because of which the only solution I have is to disable animation altogether:

 <item name="android:windowAnimationStyle">@null</item> 
0
source

Source: https://habr.com/ru/post/1209682/


All Articles