横にスクロールできる2つのCardViewが表示されたRecyclerViewを作成したいとします。下の写真と同様です。 水平スクロールでこのRecyclerViewを実行するにはどうすればよいですか?
LayoutManagerをこのコードに設定すると、目的のフォーマットが作成されますが、垂直方向にスクロールしています。 LayoutManagerの設定
recyclerView.SetLayoutManager(new GridLayoutManager(Context, 2, GridLayoutManager.Vertical, false));
このコードに間違ったフォーマットを作成しますが、それは、水平方向にスクロールされます。
recyclerView.SetLayoutManager(new GridLayoutManager(Context, 2, GridLayoutManager.Horizontal, false));
私の質問は、私が並んでおり、水平方向にスクロールすることができます2 CardViewsのフォーマットを作成するにはどうすればよいのですか?ここで
は、それが必要とされるだけの場合にはCardView XMLです:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cardView"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000">
</RelativeLayout>
</android.support.v7.widget.CardView>
GridLayoutManagerの代わりにLinearLayoutManagerを使ってみましたか? –