Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 旋转图像_Android_Animation_Rotation - Fatal编程技术网

Android 旋转图像

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"?> <

我有两个图像和一个android的imageview。我已将Image1设置为imageView。现在我想在单击ImageView时将图像旋转180度。在旋转结束时,我想将image2设置为ImageView。当单击ImageView并显示image2时,应出现相反的情况。i、 e图像2应逆时针旋转180度,然后设置图像1。 我已经有了顺时针和ant顺时针的动画文件。 对于顺时针显示,动画文件为:

<?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文件中定义的动画。试试这个链接