如何以编程方式更改进度条的旋转

时间:2016-02-10 10:52:17

标签: android android-progressbar

我有一个进度条,按预期正常工作。但是有一个按钮正在完成特定的工作。我只是想做以下事情

我想要的是什么:

我希望当我点击按钮时,圆形时钟的运动明智地旋转进度条以改变反时钟方向旋转。所以要吸引用户,他正在做一些关于scree的工作。

这就是我的尝试:

clock_wise.xml

  

res>动画> clock_wise.xml

<?xml version="1.0" encoding="utf-8"?>


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

clock_wise.xml

  

res&gt;动画&gt; anticlock_wise.xml

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

这就是我在xml

中设置进度条的方法
<ProgressBar
        android:id="@+id/empty"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:indeterminateDrawable="@anim/loading_rotation"
        android:layout_centerInParent="true"
        android:visibility="visible" />
  

现在的问题是我想通过使用这个单一进度条在旋转之间切换。

0 个答案:

没有答案