Ich möchte ein RecyclerView mit zwei sichtbaren CardViews erstellen, die horizontal scrollen können. Ähnlich wie das Bild unten. Wie erreicht man diese RecyclerView mit horizontalem Scrollen?
Wenn Sie den LayoutManager auf diesen Code einstellen, wird das gewünschte Format erstellt, aber es wird vertikal gescrollt.
recyclerView.SetLayoutManager(new GridLayoutManager(Context, 2, GridLayoutManager.Vertical, false));
das Layouts dieses Code Einstellung erzeugt ein falsches Format, aber es ist horizontal zu scrollen.
recyclerView.SetLayoutManager(new GridLayoutManager(Context, 2, GridLayoutManager.Horizontal, false));
Meine Frage ist, wie kann ich ein Format von zwei CardViews erstellen, die nebeneinander und können horizontal scrollen?
Hier ist die CardView XML nur für den Fall es gebraucht wird:
<?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>
Haben Sie versucht, einen LinearLayoutManager anstelle eines GridLayoutManagers zu verwenden? –