I have a vertical RecyclerView, where each row is a horizontal RecyclerView. What I want to do is that no matter which horizontal RecyclerViews you scroll, all of the others will scroll together.
Here is my code:
Vertical Recyclerview:
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/purchase_ticket_seats_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@layout/view_seats_horizontal"
android:nestedScrollingEnabled="false"/>
View inside Vertical Recyclerview:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="50dp"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/seats_horizontal_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/view_seat"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/seat_row_name" />
<TextView
android:id="@+id/seat_row_name"
android:layout_width="30dp"
android:layout_height="match_parent"
android:text="A"
android:textSize="18sp"
android:paddingStart="5dp"
android:paddingEnd="3dp"
android:paddingTop="7dp"
android:textColor="#fff"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
I have tried putting vertical recyclerview inside horizontal scroll view and disabled horizontal scroll of horizontal recyclerview. But no luck. I also tried giving the same scroll listener for horizontal recyclerview.
Here is the image that I want to achieve. The user can scroll vertically and if user scrolls one horizontal row others scroll together:
