以下は私のアプリケーションのレイアウトです。既にカードビューが含まれています。しかし、マップ/ニュースでGoogleカードのようなカードをスワイプすることはできません。マップ/ニュースのGoogleカードのようなアンドロイドのxamarin(ビジュアルスタジオ)のカードをスワイプする
<?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フォーラムで解決策を調べ、xcardviewがIOSでのみ利用可能であることを発見しました。
https://github.com/Cheesebaron/ViewPagerIndicator上Cheesebaronことで非常に素晴らしいのサンプルコードは、あなたの説明に基づいており、あなたは水平 'RecyclerView'を求めていますか?そうでない場合、達成したいことを教えてください。 –
ありがとうグレース、しかし私はXamarin Forumで解決策を見つけました。実際、私はViewPagerとCarousel Viewに似た機能を実現しようとしていました。 https://forums.xamarin.com/discussion/3174/viewpager-example-with-android-4-0以下のGit 上Cheesebaronことで非常に素晴らしいサンプルがある https://github.com/Cheesebaron/ ViewPagerIndicator – guruitengineer