只能在不保持的情况下执行图像视图的旋转

时间:2015-10-10 09:43:50

标签: android image

大家好我使用下面的代码进行旋转,但它只旋转一次并回到原来的位置,如何让图像保持在旋转位置?

 <?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);

1 个答案:

答案 0 :(得分:1)

使用:

anim.setFillAfter(true);
  

如果fillAfter为true,则表示此动画执行的转换   它会在完成后继续存在。如果未设置,则默认为false。注意   这适用于个人动画和使用时   AnimationSet链接动画。

相关问题