1

以下は私のアプリケーション レイアウトで、既にカード ビューが含まれています。ただし、マップ/ニュースでGoogleカードのようにカードをスワイプすることはできません。

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="8dp">
        <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:id="@+id/card_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            card_view:cardCornerRadius="8dp"
            android:elevation="2dp"
            card_view:cardBackgroundColor="@color/orange">
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/white"
                android:id="@+id/contenLayout">
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/imgSource"
                    android:layout_centerInParent="true"
                    android:scaleType="fitXY"
                    android:src="@drawable/image" />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/mytextview"
                    android:textSize="20sp"
                    android:layout_alignParentBottom="true"
                    android:textColor="@color/content"
                    android:background="@color/orange"
                    android:gravity="center_horizontal"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp"/>
            </RelativeLayout>
        </android.support.v7.widget.CardView>
    </LinearLayout>

カードをスワイプするたびに異なるデータをロードする必要があります。画面の単純なタッチ イベントとは異なり、カードのスワイプはリバーシブルです。
カードを左から右または右から左にスワイプすると、次のカードが表示されるはずです。また、xamarin フォーラムで解決策を確認したところ、IOS でのみ使用できる xcardview が見つかりました。

4

1 に答える 1