【问题标题】:Android 4.4.2 Animation Fade in and Fade outAndroid 4.4.2 动画淡入淡出
【发布时间】:2014-10-24 06:26:31
【问题描述】:

我有一个使用淡入淡出动画的应用程序。它在 android 4.2.2 的设备上正常工作。但是,相同的应用程序不会在设备 4.4.2 上显示动画。这些是我的 xml 文件

res/anim/fadein.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator" >

<alpha
    android:duration="1000"
    android:fromAlpha="0.1"
    android:toAlpha="1.0" />

res/anim/fadein.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator" >

<alpha
    android:duration="2000"
    android:fromAlpha="1.0"
    android:toAlpha="0.1" />

这就是我称之为淡出动画的地方。

animationFadeOut = AnimationUtils.loadAnimation(this, R.anim.fadeout);    
aim.startAnimation(animationFadeOut);

我非常想知道为什么 4.2.2 版可以,但 4.4.2 版不行。你能帮帮我吗?

问候

【问题讨论】:

  • 你在哪个设备上测试过?
  • 对于 4.2.2,它是 google Galaxy nexus。对于 4.4.2,它是 nexus 5 和我的 exper t7q 品牌平板电脑。前两个是模拟器。

标签: android xml animation


【解决方案1】:

尝试使用默认淡出淡入

animationFadeOut = AnimationUtils.loadAnimation(this, android.R.anim.fade_out);    
aim.startAnimation(animationFadeOut);

【讨论】:

  • 这不是我的问题的答案。我想知道为什么它在 4.4.2 上不起作用,但它在 4.2.2 上起作用。顺便说一句,您的解决方案也不适用于 4.4.2
猜你喜欢
  • 2011-09-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-20
  • 2012-12-18
  • 2011-03-18
  • 2011-10-11
相关资源
最近更新 更多