Android:完成动画后将动画旋转回到其真实状态吗? [英] Android: Rotate animation get back to its real state after finishing the animation?

查看:258
本文介绍了Android:完成动画后将动画旋转回到其真实状态吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在我的应用中旋转图像。
旋转均可正常使用。
但是,当我旋转动画完成时,图像将返回其先前位置。我希望将图像保留为旋转状态,而不是使其恢复为真实状态。

I am going to rotate the image in My app. All Works fine with the Rotation. But while i rotation animation get finish the Image wil return to its previous position. I want is to remain that image to that rotated state and not to get it back to its real state.

那么,如何使其成为可能?
要旋转图像,我使用下面的代码:

So how to make it possible? To rotate image I am using below code:

    <?xml version="1.0" encoding="utf-8"?>

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:pivotX="50%" 
    android:pivotY="50%" 
    android:fromDegrees="0"
    android:toDegrees="30"
    android:duration="2000">

</rotate>

并将其应用于ImgeView,例如:

and applying it to the ImgeView like:

myImageView.startAnimation(rotateRight);

所以,帮我解决这个问题。

So, Help me regarding this.

推荐答案

请参见如何为Android中的视图设置动画并使其保持新的位置/大小?

< set 标记内,使用

android:fillAfter="true"
android:fillEnabled="true"

通常,动画不更改视图的实际属性,只会对其进行动画处理。如果要更改实际属性,请使用AnimationListener并监听onAnimationEnd并自行进行更改。

In general, Animation does not alter the actual properties of the View, it only animates it. If you want to change the actual properties, use AnimationListener and listen for onAnimationEnd and make the changes yourself.

这篇关于Android:完成动画后将动画旋转回到其真实状态吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆