Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何以25度增量旋转图像?安卓动画_Android_Android Animation - Fatal编程技术网

Android 如何以25度增量旋转图像?安卓动画

Android 如何以25度增量旋转图像?安卓动画,android,android-animation,Android,Android Animation,我有这个用于动画的xml代码。我需要图像每半秒旋转25度。 但图像旋转360度并停止。我做错了什么 我的任务是制作一个旋转加载图像。也许可以用另一种方式来做 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <rotat

我有这个用于动画的xml代码。我需要图像每半秒旋转25度。 但图像旋转360度并停止。我做错了什么

我的任务是制作一个旋转加载图像。也许可以用另一种方式来做

    <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">
    <rotate
        android:duration="100"
        android:fromDegrees="0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="1000"
        android:toDegrees="24" />
    <rotate
        android:duration="100"
        android:fromDegrees="24"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="1000"
        android:toDegrees="48" />
    <rotate
        android:duration="100"
        android:fromDegrees="48"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="1000"
        android:toDegrees="72" />
    <rotate
        android:duration="100"
        android:fromDegrees="72"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="1000"
        android:toDegrees="96" />
   // and many more "rotate" up to android:toDegrees="360"
</set>

//还有更多的“旋转”到android:toDegrees=“360”

如果图像必须每半秒旋转25度才能旋转360度,则需要7200毫秒。所以你可以试试这种方法

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

<rotate
    android:duration="7200"
    android:fromDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:startOffset="0"
    android:toDegrees="360" />
</set>


它们都有相同的startOffset,是不是应该增加?startOffset是显示抽搐的必要条件,但不起作用。这将是一个平稳的转折。我想让它像时钟一样移动,抽搐。