我正在使用rotate animation(xml)旋转ImageView。我已将其设置为旋转360度然后再旋转回0度。它仅旋转到270度然后返回0。请您解释一下原因背后
rotate.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
>
<rotate
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="1000"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotY="50%"
android:pivotX="50%"
>
</rotate>
<rotate
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="300"
android:fromDegrees="360"
android:toDegrees="0"
android:pivotY="50%"
android:pivotX="50%"
>
</rotate>
</set>
代码:
Animation animation1=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.rotate);
imageView.setAnimation(animation1);
imageView.startAnimation(animation1);
答案 0 :(得分:1)
在Java中使用
imageView.animate().rotation(360).setDuration(1000).withEndAction(new Runnable() {
@Override
public void run() {
btnSingup.animate().rotation(0).setDuration(300);
}
});