0

我正在尝试ProgressBar通过在 Android 4.1 中使用旋转可绘制来获得自定义不确定。我这样做如下:

 <?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="360"
android:toDegrees="0"
android:drawable="@drawable/image_for_rotation"
android:pivotX="50%"
android:pivotY="50%" />

似乎参数不起作用,图像只能顺时针旋转,但我需要逆时针旋转fromDegreestoDegrees当我更改animated-rotate为 时rotate,他们开始工作,但这不是我需要的。有什么建议让它工作吗?

在此处输入图像描述

4

2 回答 2

4

我认为关键是如果你使用<animated-rotate>它是一个非公共 API。

我找不到任何关于它的官方文档。

它实际上忽略了您输入的任何值fromDegreesand toDegrees。您可以删除这两个属性,它仍然会旋转。

您说您不想使用旋转,但这是我能找到的唯一其他简单的 XML 答案:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
  android:drawable="@android:drawable/ic_lock_power_off"
  android:pivotX="50%"
  android:pivotY="50%"
  android:fromDegrees="0"
  android:toDegrees="-360" />

<animated-rotate>想要而不想要的原因是什么<rotate>

如果你想设置一个更慢或更快的帧数,你应该在这里检查这个答案:

https://stackoverflow.com/a/14996762/413127

于 2013-07-26T23:28:21.057 回答
0

改变

android:fromDegrees="360"
android:toDegrees="0"

android:fromDegrees="0"
android:toDegrees="360"
于 2014-01-02T15:08:49.830 回答