Android Multiple RecyclerView (horizontal and vertical) on 1 fragment layout

I want to use multiple RecyclerViews on the same page layout.

I need this list:

Method 1:

<ScrollView>
    <ViewPager></ViewPager> <!-- horizontal image slider 10 item -->
    <RecyclerView></RecyclerView> <!-- horizontal -->
    <RecyclerView></RecyclerView> <!-- gridview -->
    <RecyclerView></RecyclerView> <!-- horizontal -->
    <RecyclerView></RecyclerView> <!-- horizontal -->
    <RecyclerView></RecyclerView> <!-- gridview -->
    <RecyclerView></RecyclerView> <!-- horizontal -->
</ScrollView>

Method 2:

<Relativelayout>
    <RecyclerView>
        <!-- viewtype for ViewPager horizontal image slider 10 item -->
        <!-- viewtype for horizontal  -->
        <!-- viewtype for gridview -->
        <!-- viewtype for horizontal  -->
        <!-- viewtype for horizontal  -->
        <!-- viewtype for gridview -->
        <!-- viewtype for horizontal  -->
    </RecyclerView>
</Relativelayout>

To do this, I found two ways:

  • one RecyclerView -> use ItemViewType
  • Add all recycleview to one ScrollView

Which method is correct?

Each of these methods has problems, and I could not find a way.

Questions:

  • using method <ScrollView>: clear all images from the screen before scrolling down. (but scrolling is fast and smooth).
  • using one recycleview (the presentation type of several elements) is very nested, and scrolling is not smooth and fast and inactive.

What does the list design look like in GooglePlay apps? (nested and seamlessly)

+4
2

:

2 . recycleView ItemViewType. setAdapter() onBindViewHolder, . steAdapter() ViewHolder .

0

:

      <android.support.v4.widget.NestedScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:scrollbars="vertical">
          <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:orientation="vertical">
            <android.support.v7.widget.RecyclerView
             android:id="@+id/recylerView1"
             android:layout_width="match_parent"
             android:layout_height="wrap_content">
            </android.support.v7.widget.RecyclerView>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recylerView2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">            

        </android.support.v7.widget.RecyclerView>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recylerView3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

        </android.support.v7.widget.RecyclerView>

       <!--You can add as many recycler views you want here--> </LinearLayout>
        </android.support.v4.widget.NestedScrollView>
0

Source: https://habr.com/ru/post/1666206/


All Articles