【问题标题】:Issue implementing a Rotation Tween Animation in Android在 Android 中实现旋转补间动画的问题
【发布时间】:2012-07-26 17:11:34
【问题描述】:

以下是我的动画 rotate_center.xml 文件

<?xml version="1.0" encoding="UTF-8"?>
<rotate
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@anim/linear_interpolator"
    android:fromDegrees="0"
    android:toDegrees="350"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:duration="2000" />

我在 .class 中尝试做的事情

tweenAnimation = (ImageView) findViewById(R.id.imgTweenAnimation);

Animation animationRotateCenter= AnimationUtils.loadAnimation(this, R.anim.rotate_center);

tweenAnimation.startAnimation(animationRotateCenter);

while(count < animationRotateCenter.getDuration())
{
    count++;

    if(count == 4000)
    {
        Log.i(getPackageName(), getLocationClassName() + ": " + count);
        break;
    }
}

//Move to next Intent

问题是,我执行得很好,但没有显示动画。逻辑在后台运行良好,直到它被执行,然后它会中断并直接移动到下一个活动。在这件事发生期间,它只会冻结屏幕。实现补间动画的任何其他选项将在固定的时间内执行,然后在动画完成后执行一些其他任务。我选择这种技术而不是逐帧动画,因为逐帧动画需要单独的 .png 或 .9.png 为它们中的每一个,因此增加了我想避免的 .apk 文件大小。

【问题讨论】:

    标签: android android-animation


    【解决方案1】:

    1,你检查animationRotateCenter.getDuration()的值了吗? 2、我认为你不应该使用android:repeatCount="infinite"。 希望对你有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-20
      • 1970-01-01
      • 2013-05-15
      • 1970-01-01
      • 1970-01-01
      • 2013-06-05
      • 1970-01-01
      相关资源
      最近更新 更多