Here is my setup, i am running a DrawerLayout, within it is a CoordinatorLayout containing an AppBarLayout and a nestedscrollview. I am trying to have the nestedscrollview scroll normally and the Toolbar to get hidden on scrolling down and reppear on scrolling up. Attached within is my XML code. Would appreciate any help.. have read all related questions and implemented their answers without any success.
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout_admin"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/admincoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/app_bar"
layout="@layout/app_bar"
app:layout_scrollFlags="scroll|enterAlways" />
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/adminrelScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/menu_drawer" />
I think making use of the new CollapsingToolbarLayout will help… A short description from some very useful exploration of the new Android Design Support Library shows how to wrap a Toolbar in a CollapsingToolbarLayout and customize effects by setting layout_collapseMode.
update
I think adding an onScrollListener to your ListView and showing/hiding the toolbar like this example from this answer: