I have a ViewPager, that contains a RecyclerView which scrolls vertically and displays items with an adapter. Each item haves a NestedScrollView, which also should scroll vertically. The problem is that when I try to scroll that NestedScrollView, it scrolls the parent ViewPager.
How can i solve this problem?
This is the RecyclerView:
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/offersRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/table_cell_background"
android:fadeScrollbars="false"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
This is the layout of the items, which contains the NestedScrollView:
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/statusConstraintLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/table_background"
android:padding="@dimen/spacing_small"
app:layout_constraintStart_toEndOf="@+id/salaryConstraintLayout"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.55">
<androidx.core.widget.NestedScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/statusValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/offer_sent_with_three_dots"
android:textSize="@dimen/mini_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>