J'essaie d'implémenter la fonction de barre d'outils de masquage automatique à partir de la nouvelle bibliothèque de support 22.2.0. Sans SwipeRefreshLayout fonctionne très bien:
Mais quand j'ajoute cette disposition, la barre d'outils chevauchement la vue de recyclage:
Code:
<Android.support.v4.widget.DrawerLayout
xmlns:Android="http://schemas.Android.com/apk/res/Android"
Android:id="@+id/drawer_layout"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:fitsSystemWindows="true">
<Android.support.design.widget.CoordinatorLayout
xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
xmlns:fab="http://schemas.Android.com/apk/res-auto"
Android:layout_width="match_parent"
Android:layout_height="match_parent">
<Android.support.design.widget.AppBarLayout
Android:layout_width="match_parent"
Android:layout_height="wrap_content">
<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="?attr/actionBarSize"
Android:background="?attr/colorPrimary"
Android:theme="@style/ThemeOverlay.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways"/>
</Android.support.design.widget.AppBarLayout>
<Android.support.v4.widget.SwipeRefreshLayout
xmlns:Android="http://schemas.Android.com/apk/res/Android"
Android:id="@+id/swipe_container"
Android:layout_width="match_parent"
Android:layout_height="match_parent">
<Android.support.v7.widget.RecyclerView
Android:id="@+id/cardList"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</Android.support.v4.widget.SwipeRefreshLayout>
</Android.support.design.widget.CoordinatorLayout>
</Android.support.v4.widget.DrawerLayout>
Une idée de comment résoudre ce problème?
Définissez le comportement de défilement sur SwipeRefreshLayout
et non sur RecyclerView
.
<Android.support.v4.widget.SwipeRefreshLayout
Android:id="@+id/swipe_container"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<Android.support.v7.widget.RecyclerView
Android:id="@+id/cardList"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:scrollbars="vertical" />
</Android.support.v4.widget.SwipeRefreshLayout>