AppBarLayout is not always re-entered when scrolling down

I created a minimized transparent search bar using AppBarLayout, CollapsingToolbarLayout inside CoordinatorLayout and RecyclerView. It was a little (much) ingenious that the recyclerView appeared behind the appBarLayout, and not under it; but it works. My problem is that sometimes the application bar doesn't come back when I scroll down. I just stay invisible off screen. Here is my layout:

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    app:expandedTitleMarginBottom="88dp">

<android.support.v7.widget.RecyclerView
    android:id="@+id/services_recycler_view"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    app:behavior_overlapTop="88dp">

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

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:background="@color/color_transparent"
        app:elevation="0dp">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_scrollFlags="scroll|enterAlways"
        android:fitsSystemWindows="false">

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Search Location or Service"
    android:id="@+id/button_search_bar"/>



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

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

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

Any help on resolving the problem without re-entering would be great.

The side problem is that since I use app:behavior_overlapTop="88dp"make recyclerView to appear behind the application bar, the whole scroll is a bit strange: it starts by scrolling the appBar and then scrolls the recycler view. Any best solution is welcome.

: , AppBar , ( , ). , =)

+4
1

, , , , !

enter image description here

, ?

Edit:

  <android.support.design.widget.CollapsingToolbarLayout
      android:id="@+id/collapsing_toolbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:fitsSystemWindows="false"
      app:layout_scrollFlags="scroll|exitUntilCollapsed">

exitUntilCollapsed.

0

Source: https://habr.com/ru/post/1617522/


All Articles