Java 在ImageView之间切换

Java 在ImageView之间切换,java,android,xml,Java,Android,Xml,我希望能够通过单击imgCardF和imgCardB在imgCardF和imgCardB之间切换, 像翻转卡片的效果。 下面是我的xml代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android

我希望能够通过单击imgCardF和imgCardB在imgCardF和imgCardB之间切换, 像翻转卡片的效果。 下面是我的xml代码:

  <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical" >

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

     <ImageView
        android:id="@+id/imgCardF"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_weight="1"
        android:background="#34232b" />

     <ImageView
        android:id="@+id/imgCardB"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_weight="1"
        android:background="#ababab" />

    </RelativeLayout>

   </LinearLayout>

您可以先将这两个图像视图进行交叉淡入淡出。
下面是一个实现这种效果的方法


或者,您可以直接跳转到此的CardFlip动画。

为这两个设置onClickListener并替换剪辑中的图像。请查看
ImageSwitcher
。这是我的问题,如何在单击时替换图像?