活动动画不起作用

活动动画不起作用

本文介绍了Android:活动动画不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在应用程序的活动之间进行切换时,我无法理解为什么自定义动画不能覆盖系统动画.

I have not been able to understand why my custom animations are not overriding the system animations when i switch between activities in my app.

styles.xml

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:

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

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

设置完所有这些后,我希望能看到褪色的动画,但这根本没有发生.

With these all set, I was hoping to see fading animations but this is not happening at all.

仅供参考,我注意到如果我改用android:windowEnterAnimationandroid:windowExitAnimation并在动画文件中将android:duration的值增加到类似2000的方式,那么我的确看到了非常慢的淡入淡出的动画,但是我希望所有四个动画都具有情况和更快的褪色.

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

我正在使用Kitkat 4.4.2.谢谢您的帮助

I am using Kitkat 4.4.2. Thanks for your help

推荐答案

这通常发生在Android 4.4.2上.试试这个

This usually happened at Android 4.4.2. Try this

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

这篇关于Android:活动动画不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 14:36