[英]Floating Action Button diasappears under SECOND Snackbar
我正在使用CoordinatorLayout将浮动操作按钮保持在Snackbar上方,效果很好。 ...但仅限于第一个Snackbar。 创建第二个时,第一个仍在其中,而FAB则在其下方滑动。
我在RecyclerView中使用它,可以在其中删除项目。 删除项目后,将出现“撤消”小吃栏。 因此,当您一个接一个地删除某些项目时,可见的Snackbar被一个新的替换(这会导致FAB行为)
您是否知道将FAB保持在新的小吃店之上的解决方案?
<?xml version="1.0" encoding="utf-8"?>
<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/tools"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:backgroundTint="@color/background_grey"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:elevation="6dp"
android:src="@drawable/ic_add_white_36dp"
app:borderWidth="0dp"
app:fabSize="normal"
app:pressedTranslationZ="10dp"
app:rippleColor="@color/abc_primary_text_material_dark" />
</android.support.design.widget.CoordinatorLayout>
这是我删除项目后的样子
...然后删除其他项目
这将始终发生,因为快餐栏是视图上方的一层。在这种情况下,不应使用堆叠的快餐栏。请参见google gidelines。https ://www.google.co.in/design/spec/components/snackbars- toasts.html#小吃店,敬酒使用率
相反,您的实现应类似于https://github.com/jenzz/Android-UndoBar
更改设计的歉意
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.