0

I want to create a layout with: toolbar on top tablayout with 3 tabs two of the tabs show a list one of the tab shows a grid

On scrolling the list/grid the toolbar should collapse and the tablayout should go on top. I have this worked out but I am working with a dummy list of the type:

<android.support.v4.widget.NestedScrollView
 app:layout_behavior="@string/appbar_scrolling_view_behavior"
....>
    <LinearLayout
    ...
    />
    ...
    .... copied 10 times
</NestedScrollView>

I now want to use a real list, like a listview and a gridview. What do I use? Is it okay to use a listview inside a NestedScrollView?

user2759617
  • 597
  • 1
  • 8
  • 20

2 Answers2

2

You should use RecyclerView instead of Listview. Take a look at this android developer blog post about the Design Support Library [LINK]

Also never use a ListView / GridView / RecyclerView in ScrollView or NestedScrollView. [LINK]

Community
  • 1
  • 1
zkminusck
  • 1,230
  • 1
  • 12
  • 23
2

try it in listview:

app:layout_behavior="@string/appbar_scrolling_view_behavior"

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<ListView
    android:layout_width="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:layout_height="match_parent" />

Elton da Costa
  • 1,279
  • 16
  • 27