Android 旋转图像
我有两个图像和一个android的imageview。我已将Image1设置为imageView。现在我想在单击ImageView时将图像旋转180度。在旋转结束时,我想将image2设置为ImageView。当单击ImageView并显示image2时,应出现相反的情况。i、 e图像2应逆时针旋转180度,然后设置图像1。 我已经有了顺时针和ant顺时针的动画文件。 对于顺时针显示,动画文件为:Android 旋转图像,android,animation,rotation,Android,Animation,Rotation,我有两个图像和一个android的imageview。我已将Image1设置为imageView。现在我想在单击ImageView时将图像旋转180度。在旋转结束时,我想将image2设置为ImageView。当单击ImageView并显示image2时,应出现相反的情况。i、 e图像2应逆时针旋转180度,然后设置图像1。 我已经有了顺时针和ant顺时针的动画文件。 对于顺时针显示,动画文件为: <?xml version="1.0" encoding="utf-8"?> <
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="1000"
android:fromdegrees="0"
android:pivotx="50%"
android:pivoty="50%"
android:todegrees="180"
android:toyscale="0.0" />
</set>
对于逆时针方向:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="1000"
android:fromdegrees="0"
android:pivotx="50%"
android:pivoty="50%"
android:todegrees="-180"
android:toyscale="0.0" />
</set>
如果您查看了Android开发者指南,它描述了如何使用您在XML文件中定义的动画。试试这个链接