How to hide toolbar, when scrolling webview? I know, that webview must be in NestedScrollView and CoordinatorLayout, toolbar - in AppBarLayout.But I really cant to do it.
If anybody can help me, I would be very grateful.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/main_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/custom_toolbar_size" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/custom_tablayout_size"
android:layout_gravity="bottom"
android:background="@color/toolbarColor"
app:tabIndicatorHeight="0dp"
>
<android.support.design.widget.TabItem
android:id="@+id/ti_arrow_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_arrow_back" />
<android.support.design.widget.TabItem
android:id="@+id/ti_arrow_forward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_arrow_forward" />
<android.support.design.widget.TabItem
android:id="@+id/ti_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_update" />
<android.support.design.widget.TabItem
android:id="@+id/ti_inset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_inset" />
<android.support.design.widget.TabItem
android:id="@+id/ti_star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_star_border" />
</android.support.design.widget.TabLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/custom_tablayout_size"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/custom_toolbar_size"
android:background="@color/toolbarColor"
android:paddingTop="2dp"
app:layout_scrollFlags="scroll|enterAlways" />