如何提高android的转速?

Pra*_*een 40 animation android rotation

我有一个可绘制的图像.我像进度条一样旋转图像.

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0"
android:toDegrees="360" android:drawable="@drawable/spinner_white_48" />
Run Code Online (Sandbox Code Playgroud)

我想提高转速?为此,我必须使用什么属性?

Dus*_*inB 124

使用不确定的ProgressBar动画设置持续时间和/或重复计数并没有帮助我.我不得不增加toDegrees以使其产生额外的循环:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/ic_indeterminate_progress"
    android:duration="1"
    android:fromDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toDegrees="1080" /> <!--1080 is 3 loops instead of 1 in same amt of time-->
Run Code Online (Sandbox Code Playgroud)


and*_*per 37

根据这个链接:

不确定进度条的旋转速度固定为每4秒旋转一次,更改可绘制XML中的持续时间属性无效.如果您希望加快速度,可以将toDegrees属性更改为360的倍数:

  • 720在2秒内转一圈
  • 1080在1.33秒内转一圈
  • 1440在1秒内转一圈

此外,您可以对ProgressBar使用indeterminateDuration.


小智 10

将代码添加到progress.xml

 <rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:pivotX="50%"
    android:pivotY="50%"
    android:fromDegrees="0"
    android:toDegrees="1080" /> <!--1080 is 3 loops instead of 1 in same amt of time-->
Run Code Online (Sandbox Code Playgroud)


Rob*_*ond 5

设置希望动画运行的持续时间repeatCount

  • 如果repeatCount应该为0,以使其永久旋转(用于progressBar,在“ indeterminateDrawable”中)怎么办?在这种情况下,持续时间似乎没有任何作用... (2认同)