AlphaAnimation不适用于Gingerbread手机?

时间:2013-07-10 11:40:19

标签: android android-animation android-view android-2.3-gingerbread

以下代码在Ice Cream Sandwich手机中淡出了一个View,但在Gingerbread手机上没有:

myView.setVisibility(View.VISIBLE);

AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
alphaAnimation.setDuration(3000);

myView.startAnimation(alphaAnimation);

......任何人都知道为什么会这样?

  

注意:我尝试了View.setAnimation(alphaAnimation)方法以及明确调用alphaAnimation.start()方法,但两者在Gingerbread手机上都失败了。

3 个答案:

答案 0 :(得分:0)

尝试为动画提供startoffset。

您还确定您的视图myView位于其他视图之上吗?动画可能正在运行但可能不可见,因为它可能低于其他视图。

答案 1 :(得分:0)

使用@CommonsWare的评论,我改变了我动画的方式,不改变View的可见性。在这样做的过程中,我意识到问题与我的View的alpha动画无关,而是与我的布局(z排序)无关,无论动画如何。

我在这里发布了一个新问题:

FrameLayout z-order not behaving as expected on Gingerbread?

答案 2 :(得分:0)

大多数姜饼手机都会在设置中禁用动画。检查并确保已启用动画。

相关问题