Android-在两个图像之间翻转水平动画

Android-在两个图像之间翻转水平动画,android,android-layout,animation,viewflipper,Android,Android Layout,Animation,Viewflipper,我正在尝试创建两个图像的动画。我想要的图像,点击后,它水平翻转180度到新图像(从前到后),就像一张卡片。我想对布局上的多个图像执行此操作。如何编写此代码一次并在需要执行时调用它?在Resource->Create anim folder->xml file中使用任意名称 In Resource->Create anim folder->xml file with any name <set xmlns:android="http://schemas.andro

我正在尝试创建两个图像的动画。我想要的图像,点击后,它水平翻转180度到新图像(从前到后),就像一张卡片。我想对布局上的多个图像执行此操作。如何编写此代码一次并在需要执行时调用它?

在Resource->Create anim folder->xml file中使用任意名称
In Resource->Create anim folder->xml file with any name



     <set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">
  <scale
            android:fromXScale=".3"
            android:toXScale="1.0"
            android:fromYScale="0.3"
            android:toYScale="1.0"
            android:pivotX="50%"
            android:pivotY="50%"
            android:duration="800" />

        <rotate
            android:fromDegrees="0"
            android:toDegrees="180"

            android:pivotX="50%"
            android:pivotY="50%"
            android:duration="800" />

</set>
现在,您可以在任何地方使用此动画,也可以不使用任何时间