Search code examples
androidscrollviewandroid-recyclerviewflipboard

Two recycler view in same layout as in flipboard app


I want to use a RecyclerView(list like) below another RecyclerView(Grid like) as in flipboard

enter image description here

I tried two RecyclerView inside ScrollView with wrap content but nothing is showing.

I can able to see two views if it is placed in linear layout and equal weight is added to it. But that does not look like this app View.

This is my layout

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical">

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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/parent_category_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minWidth="@dimen/default_small_padding"
        android:gravity="center"
        android:visibility="visible"/>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/category_grid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:columnWidth="150dp"
        android:gravity="center"
        android:visibility="visible"/>

</LinearLayout>


Solution

  • I don't think that they use two ListViews (or ListView + GridView).

    I think they use a ListView ( the one in the bottom) and they add a custom Header to this list (the one in the top), which look like a GridView.

    Or if they use a Recyclerview, they can achieve this by using a different layout in the adapter for the first item.

    PS: it's not recommended to use two scrollable view inside each other (like Recyclerview inside ScrollView).