- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图向用户展示位于 MainActivity 中的 Snackbar RideFragment。但 BottomNavigation 与 Snackbar 重叠,因此 Snackbar 根本不可读/不可见。我看到通过使用额外的 CoordinatorLayouts 解决了一些类似的问题,但我可以让它工作。
这是 MainActivity 的 XML:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
android:foreground="?attr/selectableItemBackground"
app:itemBackground="@color/colorPrimaryDark"
app:itemHorizontalTranslationEnabled="false"
app:itemIconTint="@android:color/white"
app:itemTextColor="@android:color/white"
app:menu="@menu/navigation" />
有人可以帮助我吗?
这是 RideFragment 的 XML(用于“Rides”选项卡)
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main.RidesFragment">
<Button
android:id="@+id/offerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="128dp"
android:text="Offer"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/searchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="Search"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/offerButton" />
最佳答案
将此属性添加到您的 BottomNavigationView
中:
app:layout_dodgeInsetEdges="bottom"
并使用容器作为 View 属性来调用 SnackBar
:
Snackbar.make(container, "Snackbar", Snackbar.LENGTH_SHORT).show()
关于android - BottomNavigation 下的 Snackbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55126880/
Snackbar.make(...).show() 将只显示最后一个 snackbar,不像 toast 其他 snackbar 都消失了。 for(int i = 1;i mSnackbarLis
Snackbar.make(...).show() 将只显示最后一个 snackbar,不像 toast 其他 snackbar 都消失了。 for(int i = 1;i mSnackbarLis
我有一个实现 swipetorefresh 布局的 recyclerview - 如果您在列表中向下滑动手指,它将加载较新的帖子。它还有一个 onloadmorelistener 用于对我的 recy
我正在尝试添加 Snackbar到我的应用程序, Snackbar.make(findViewById(android.R.id.content), R.string.not_
我对 snackbar 有疑问。我的 snackbar 对解雇没有反应 我的代码: ConnectivityReceiver = new BroadcastReceiver() { @
我试图在显示 snackbar 时将焦点直接放在 snackbar 中的操作按钮上,以便让用户知道可以使用 snackbar 中显示的警报消息执行某些操作。注意:这是针对对讲模式。我尝试使用 requ
如果我连续多次调用snackbar,则只显示最后一个snackbar 项。 例如使用下面的代码,只会显示第 3 项。似乎第 1 项和第 2 项的 Snackbar.LENGTH_LONG 被忽略(并设
我的应用程序中有一个包含消息的 RecyclerView。在向右滑动时,我将其配置为删除消息,在向左滑动时,我将其配置为存档消息。下面是 ItemTouchHelper 部分删除归档相关的代码: if
我正在尝试使用此设置 snackbar 长度: Snackbar oSnackbar = Snackbar.make(Context, "Testing", Snackbar.LENGTH_LONG)
flutter SnackBar的动画入口是什么? ScaffoldMessanger.of(context).showSnackBar(SnackBar( animation: /* --- *
在我的应用程序中,可能(并且有意!)多个 SnackBar元素被创建。这些 SnackBar元素排队并一个接一个地显示,这一切都很好。但是,如果我转到不同的屏幕然后返回(所以 push 和 pop 一
我有一个 flutter 应用程序,它在应用程序的不同屏幕上发出许多不同的 http 请求。现在,我想实现一些通用的错误处理,例如,每当没有连接时,我都想显示一个 SnackBar,无论我目前在应用程
我因为工作室提示 Dialog 而苦苦挣扎已弃用, 所以我又去阅读文档,似乎 Toast也被弃用了。 所以我尝试从 Toast 迁移至Snackbar ,但目前失败...我 我加了 implement
我有问题在我的应用程序中实现了 BLoC 模式。 一旦我有一个特殊的事件,我需要显示一个 snackbar ,但我有这个错误: The following assertion was thrown b
我尝试在 JavaScript 中使用“if else”语句,但无法使其工作。 这是js脚本: var vid = document.getElementById("myVideo"); functi
我使用 Material 2 创建了 Snackbar(下面我添加了演示)。我在主页中有一个按钮,当我单击该按钮时,它会在页面底部显示消息(snackbar)。我想将其(快捷栏消息)更改为页面的右上角
我有按钮而不是 float 操作按钮,我想将其与 snackbar 锚定,因为它与 float 操作栏锚定,就像显示 snackbar 时 float 操作按钮向上移动一样,对于 float 操作栏,
在ReactJS中,我想仅在登录成功时显示material-ui Snackbar。在ReactJS中有哪些方法可以做到这一点? 最佳答案 Material-ui Snackbar 的 open 状态
您好,我有一段代码可以生成 snackbar 。我使用带有关闭选项的 Bootstrap 警报来生成 snackbar ,但是当我单击关闭按钮时,它对我不起作用。是否可以添加关闭选项?如果是,你能解释
令我惊讶的是,如果 TextView 跨越多行,Snackbar 本身似乎会在 TextView 上设置额外的填充。它有效地使 Snackbar 的高度加倍,并且由于某种原因仅影响垂直填充。我在 Sn
我是一名优秀的程序员,十分优秀!