我想使用ViewAnimator从一个视图转换到另一个视图(在我的测试应用程序中,视图是TextView)。下面列出了我的两个动画。我看到的行为都是动画,只要我触发animator就开始动画,而不是让InAnimation运行,并且一旦它完成了OutAnimation运行。我看到的东西看起来像一个风车 - 旋转出来的视图垂直于旋转的视图。我想看到旋转的视图从它的正常水平位置(0度)到垂直(90度);然后我想看到旋转的视图从垂直(-90度)到水平(0度)。ViewAnimator使用旋转动画在视图之间转换
@阿尼姆/ rotate_out.xml
<?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:repeatCount="0" android:duration="500"
android:interpolator="@android:anim/linear_interpolator">
</rotate>
@阿尼姆/ rotate_in.xml
<?xml version="1.0" encoding="UTF-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="-90" android:toDegrees="0" android:pivotX="50%"
android:pivotY="50%" android:repeatCount="0" android:duration="500"
android:interpolator="@android:anim/linear_interpolator">
</rotate>
,并在主要活动的onCreate ...
va = (ViewAnimator) findViewById(R.id.ViewFlipper01);
va.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate_in));
va.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate_out));
什么想法?
我为InAnimation和OutAnimation设置了什么,因为现在只有一个anim xml文件? –