How to add other scrollable views before a recyclerview?

Viewed 21

I am new to android and this is my first time asking question on stackoverflow. I am trying to implement a layout that has

  1. A horizontal ViewPager2
  2. Some horizontal scrolling RecyclerViews
  3. A vertical main RecyclerView

For now I have wrapped all of the above views inside a NestedScrollView like this

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include
            android:id="@+id/vpMainCarasouel"
            layout="@layout/item_carasouel" />

        <include
            android:id="@+id/rvTrendingSlide"
            layout="@layout/rv_image_card_slide" />

        <include
            android:id="@+id/rvPopularSlide"
            layout="@layout/rv_image_card_slide" />

        <include android:id="@+id/rvTopRated"
            layout="@layout/rv_image_card_vertical"
            />

    </LinearLayout>
</androidx.core.widget.NestedScrollView>

But I have read that using a Vertical Scroll view (The Vertical RecyclerView rvTopRated) inside another Vertical ScrollView (NestedScrollView) is not a good practice.

So how can I add other views (that requires scroll) and then continue on with a main Vertical RecyclerView (rvTopRated) ?

Here is the layout I am trying to implement.

0 Answers
Related