大家好我使用下面的代码进行旋转,但它只旋转一次并回到原来的位置,如何让图像保持在旋转位置?
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:duration="1000"
android:startOffset="0"
/>
我的代码的xml文件
Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotate);
a.startAnimation(rotation);
答案 0 :(得分:1)
使用:
anim.setFillAfter(true);
如果fillAfter为true,则表示此动画执行的转换 它会在完成后继续存在。如果未设置,则默认为false。注意 这适用于个人动画和使用时 AnimationSet链接动画。