gpt4 book ai didi

android - 只能在不持有的情况下执行 ImageView 的旋转

转载 作者:行者123 更新时间:2023-11-30 01:51:00 27 4
gpt4 key购买 nike

大家好,我用下面的代码进行旋转,但是只旋转了一次就回到了原来的位置,如何让图像停留在旋转后的位置?

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

最佳答案

使用:

anim.setFillAfter(true);

If fillAfter is true, the transformation that this animation performed will persist when it is finished. Defaults to false if not set. Note that this applies to individual animations and when using an AnimationSet to chain animations.

关于android - 只能在不持有的情况下执行 ImageView 的旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33052569/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com