RecyclerView en CoordinatorLayout pierde su relleno superior después de cambios de orientación
Estoy usando la Biblioteca de Diseño de Apoyo rev. 23.0.1 (y 22.2.1 también). El problema es después de cambios de orientación de actividad si RecyclerView (colocado en fragmento) se ha desplazado, pierde su relleno superior que es probablemente igual a StatusBar altura + AppBar altura (como se ve en una imagen).
Vea este ejemplo de video para más detalles
- La vista no puede anclarse en el parámetro CoordinatorLayout principal
- Android BottomSheetDialogFragment no se expande por completo
- Gráfica de Lollipop
- Cómo implementar Bottom Sheets usando la nueva biblioteca de soporte de diseño 23.2
- Configuración del comportamiento del botón de acción flotante mediante programación
Aquí está mi diseño de la actividad
<android.support.design.widget.CoordinatorLayout android:id="@+id/coordinatorLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:id="@+id/discount_activity_app_bar_layout" android:layout_width="match_parent" android:layout_height="256dp" app:layout_behavior="com.moskart.mosfake.widget.AppBarLayoutBehavior" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:fitsSystemWindows="true" > <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsingToolbarLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginStart="@dimen/expanded_toolbar_title_margin_start" app:expandedTitleMarginBottom="96dp" app:expandedTitleTextAppearance="@style/TextAppearance.Design.CollapsingToolbar.Expanded" app:layout_scrollFlags="scroll|exitUntilCollapsed" > <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/hero_image" app:layout_collapseMode="parallax" app:layout_collapseParallaxMultiplier="0.7" android:fitsSystemWindows="true" /> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> </android.support.v7.widget.Toolbar> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" app:behavior_overlapTop="64dp" android:fitsSystemWindows="true" > <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/fragment" android:name="com.moskart.mosfake.fragment.DiscountFeedFragment" tools:layout="@layout/fragment_discount_feed" android:layout_width="match_parent" android:layout_height="match_parent" /> </FrameLayout> </android.support.design.widget.CoordinatorLayout>
Y un fragmento simple contiene RecyclerView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.moskart.mosfake.fragment.DiscountFeedFragment" > <com.moskart.mosfake.widget.GridRecyclerView android:id="@+id/recycler_view_discount_feed" android:layout_width="match_parent" android:layout_height="match_parent" />
Por cierto, he encontrado algunos problemas siguientes, pero estas respuestas no resuelven mi problema. También he intentado enfoques descritos aquí y aquí , pero no tiene ningún efecto, o estoy haciendo algo mal.
¡Gracias por tu ayuda!
- CoordinatorLayout + ActionBar + Fragmentos
- Cómo agregar Snackbars en un BroadcastReceiver?
- Android AppCompat 23.1.0 Tinte Compuesto Dibujable
- Cómo inhabilitar el arrastre del usuario en la parte inferior
- NavigationView diapositiva desde la derecha
- Cambiar los iconos TabLayout a la izquierda, arriba, derecha o abajo en com.android.support:design:23.1.0
- AppBarLayout.setExpanded (boolean, true) animación extraña en la biblioteca de soporte 23.1.1
- Vector Drawables bandera no funciona en la Biblioteca de Soporte 24+
- La animación del hilador personalizado no es lo suficientemente suave: framesCount y error frameDuration
- RecyclerView Deslice con una vista inferior y no detecte clic