mzgreen / HideOnScrollExample

This is an example on how to show/hide views when scrolling a list.
620 stars 173 forks source link

set Coordinator Layout to “ONLY” snap toolbar #11

Open BehnamMaboodi opened 9 years ago

BehnamMaboodi commented 9 years ago

This is my main layout:

<android.support.design.widget.AppBarLayout
    android:id="@+id/appBarLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways|snap"/>
</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/viewPager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

I want to set the toolbar to snap mode but with this code , Coordinator Layout also shifts viewpager with toolbar.

I want same effect as play store actionbar.