Сворачивающаяся панель инструментов возвращается после быстрой прокрутки

Здесь я использую сворачивающуюся панель инструментов, которая включает в себя ползунок вверху, два горизонтальных списка элементов от recyclerview посередине и вкладку. Я использовал tablayout для списка категорий. Теперь у меня есть одна проблема: всякий раз, когда я быстро прокручиваю вверх, вид отскакивает вниз. Я хочу закрепить панель инструментов и вкладку на экране.

Вот мой дизайн:

введите здесь описание изображения

Макет приведен ниже:

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#060C18"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:fitsSystemWindows="true"
    app:layout_anchorGravity="bottom"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.design.widget.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/livetv_bg_list"
        android:fitsSystemWindows="true"
        app:titleEnabled="false"
        app:contentScrim="#060C18"
        app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <RelativeLayout
                android:id="@+id/banner_relative_layout"
                android:layout_width="match_parent"
                android:layout_height="370dp">
                <com.newitventure.nettv.nettvapp.ott.utils.AutoScrollViewPager
                    android:id="@+id/movieslider"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="?attr/actionBarSize"
                    android:gravity="right|end"
                    android:paddingRight="10dp">

                    <me.relex.circleindicator.CircleIndicator
                        android:id="@+id/indicator"
                        android:layout_width="wrap_content"
                        android:layout_height="40dp"
                        android:layout_marginTop="20dp"
                        app:ci_drawable="@drawable/banner_indicator_color"
app:ci_drawable_unselected="@drawable/banner_unselected_indicator_color" />

                </RelativeLayout>

            </RelativeLayout>

            <LinearLayout
                android:id="@+id/main_linear"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/banner_relative_layout"
                android:background="#060C18"
                android:orientation="vertical"
                android:visibility="visible">

                <RelativeLayout
                    android:id="@+id/recently_added_relative_layout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@+id/banner_relative_layout"
                    android:layout_marginBottom="16dp"
                    android:layout_marginTop="16dp"
                    android:visibility="gone">

                    <TextView
                        android:id="@+id/recently_added_tv"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="RECENTLY ADDED"
                        android:textColor="#fff" />

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/movie_recently_added_recycler_view"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/recently_added_tv"
                        android:layout_marginTop="8dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:layout_marginEnd="16dp"
                        android:layout_marginRight="16dp"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="SEE MORE"
                            android:textColor="#ff7b52" />

                        <View
                            android:layout_width="match_parent"
                            android:layout_height="2dp"
                            android:background="#ff7b52" />

                    </LinearLayout>

                </RelativeLayout>

                <RelativeLayout
                    android:id="@+id/continue_watching_relative_layout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
android:layout_below="@+id/recently_added_relative_layout"
                    android:layout_marginBottom="16dp"
                    android:visibility="visible">

                    <TextView
                        android:id="@+id/continue_watching_tv"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="CONTINUE WATCHING"
                        android:textColor="#fff" />

                    <android.support.v7.widget.RecyclerView
                      android:id="@+id/movie_continue_watching_recycler_view"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_below="@id/continue_watching_tv"
                        android:layout_marginTop="8dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:layout_marginEnd="16dp"
                        android:layout_marginRight="16dp"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="SEE MORE"
                            android:textColor="#ff7b52" />

                        <View
                            android:layout_width="match_parent"
                            android:layout_height="2dp"
                            android:background="#ff7b52" />

                    </LinearLayout>

                </RelativeLayout>

            </LinearLayout>

        </RelativeLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin">

            <ImageView
                android:id="@+id/ham_menu"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginLeft="16dp"
                android:layout_marginTop="16dp"
                android:src="@drawable/menu" />

        </android.support.v7.widget.Toolbar>

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

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

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

        <android.support.design.widget.TabLayout
            android:id="@+id/movie_categories"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/main_linear"
            android:background="#060C18"
            app:tabGravity="center"
            app:tabIndicatorColor="#ff7b52"
            app:tabIndicatorHeight="4dp"
            app:tabMode="scrollable"
            app:tabSelectedTextColor="#DDDDDD"
            app:tabTextColor="#9095A0" />

        <android.support.v4.view.ViewPager
            android:id="@+id/movie_categories_detail_list"
            android:layout_width="match_parent"
            android:layout_height="500dp"
            android:layout_marginTop="8dp" />

    </LinearLayout>

</android.support.v4.widget.NestedScrollView>

<Button
    android:id="@+id/movie_categories_view_all"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="View All"
    android:visibility="gone" />

<ProgressBar
    android:id="@+id/movie_progress"
    style="?android:attr/progressBarStyle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_gravity="center"
    android:visibility="visible" />

<com.newitventure.nettv.nettvapp.search.MeroListView
    android:id="@+id/search_listview"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_marginTop="50dp"
    android:background="@drawable/list_view_bg"
    android:divider="@null"
    android:visibility="gone" />

Please help me out!!


person Kabindra Shrestha    schedule 17.01.2018    source источник
comment
дубликат этого сообщения . Проверьте это   -  person RJFares    schedule 01.02.2018
comment
@RJFares Этот вопрос не является дубликатом сообщения выше. Он гораздо более разный. Я хочу, чтобы моя сворачивающаяся панель инструментов не отскакивала вниз всякий раз, когда я быстро прокручиваю ее. Я обновил вопрос с дизайном. Пожалуйста, помогите мне.   -  person Kabindra Shrestha    schedule 07.02.2018