Strange behavior with CoordinatorLayout, AppbarLayout and SwipeRefreshView

I'm trying to use the new Android support design library, but I'm running into weird behavior (maybe not that weird) with CoordinatorLayout having AppBarLayout and SwipeRefreshView children: actually when I sit up SwipeRefreshView AppbarLayout hides the toolbar, even the first one them is empty.

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer_layout"
android:fitsSystemWindows="true"
>

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.v7.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/toolbar"
            android:minHeight="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:layout_scrollFlags="scroll|enterAlways"/>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_refresh"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        >
        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:scrollbars="vertical"
            >
        </android.support.v7.widget.RecyclerView>
    </android.support.v4.widget.SwipeRefreshLayout>


    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:src="@drawable/ic_add"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:fabSize="normal"
        android:layout_gravity="end|bottom"
        android:layout_margin="16dp"
        android:tint="@android:color/white"
        />

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

<android.support.design.widget.NavigationView
    android:id="@+id/navigation_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">
</android.support.design.widget.NavigationView>

      

https://www.dropbox.com/s/vfgcnh3rloeva93/issue.gif?dl=0

Here I have placed a mockup and GIF to show this behavior. Any ideas?

+3
android android-toolbar coordinator-layout


source to share


No one has answered this question yet

See similar questions:

44
Android: CollapsingToolbarLayout and SwipeRefreshLayout stuck
18
CoordinatorLayout (AppbarLayout) does not display toolbar correctly
nine
Stop AppBarLayout from scrolling when NestedScrollView is empty

or similar:

1207
Strange memory issue when loading image into Bitmap object
157
Add Views Below Toolbar to CoordinatorLayout
50
Toolbar won't hide with Scrollview as child of CoordinatorLayout
37
CoordinatorLayout + AppBarLayout + NavigationDrawer
24
Android CoordinatorLayout + AppbarLayout + Viewpager always scrolls
23
Content behind coordinatorLayout AppBarLayout
13
CoordinatorLayout and AppBarLayout
nine
CoordinatorLayout custom behavior with AppBarLayout
0
CoordinatorLayout, AppBarLayout rollback
0
Strange CoordinatorLayout / AppBarLayout behavior



All Articles
Loading...
X
Show
Funny
Dev
Pics