Android 在imageview中旋转动画
我尝试用动画旋转imageview。我写了一些代码。这是我的xml动画代码Android 在imageview中旋转动画,android,android-animation,Android,Android Animation,我尝试用动画旋转imageview。我写了一些代码。这是我的xml动画代码 <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" /> 我尝试在持续时间结束时取消动
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite" />
我尝试在持续时间结束时取消动画。但我可以旋转图像视图,但无法取消动画
我怎样才能解决我的问题?如果有人知道解决方案,请帮助我尝试以下方法:
myImage.startAnimation(myRotation); // to start animation
myImage.cancelAnimation(); // to cancel animation
动画不需要使用处理程序 只要用这个: 动画xml:
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="1"
android:duration="1000"/>
希望有帮助。更改重复计数。感谢它工作。可以检查动画速度。我知道如何检查动画速度,但我的意思是,动画速度会自动慢下来,这可能取决于角度和轴@贝卡
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="1"
android:duration="1000"/>
myImage.startAnimation(myRotation); //this will stop animation after 1000 miliseconds as `repeatCount` is 1.