0

以下是我的动画 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 文件大小。

4

1 回答 1

0

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

于 2012-07-26T09:11:34.403 回答