- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我从 API 28 向 BottomAppBar 添加了一个 FAB,如下面的 XML 所示。问题是它漂浮在底栏上方太高而不是坐在 Gradle 中。如果我将 app:fabCradleVerticalOffset 设置为 0dp,则没有任何变化。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout android:paddingTop="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.bottomappbar.BottomAppBar
android:id="@+id/bottomAppBar"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="bottom"
app:backgroundTint="@android:color/white"
app:fabAlignmentMode="center" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabIncrement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_exposure_plus_1_black_24dp"
app:backgroundTint="@color/colorPrimary"
app:fabSize="normal"
app:layout_anchor="@id/bottomAppBar" />
</android.support.design.widget.CoordinatorLayout>
最佳答案
这似乎是 BottomAppBar
的错误(或者可能是功能)。 FAB 的垂直偏移量取决于 BottomAppBar 的高度;如果您将 layout_height
设置为 48dp
,它将很好地放置在 Gradle 中。另一方面,如果将高度设置为 200dp
,您会发现 FAB 距离更远。
此外(不幸的是)app:fabCradleVerticalOffset
必须是正值。如果您尝试使用负值(将 FAB 向下推),应用程序将在运行时崩溃。
我没有看到任何公共(public) API 可以让您解决这个问题。相反,您只需为 BottomAppBar
使用较小的高度。或许您可以将两个 View 拼接在一起以模拟更高的条形。
关于android - FloatingActionButton 比 BottomAppBar 高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54044293/
当在 hideonScroll 设置为 true 时导航我的应用程序并向上/向下滚动时,我的 FabCradleMargin 在底部应用程序栏中变得更少,几乎是平坦的。当 BottomAppBar 从
我正在尝试测试来自 material.io 的 BottomAppBar 功能。但是,当我尝试运行应用程序时,我遇到了即时崩溃: > 10-20 22:21:25.067 27571-27571/co
我在这样的布局中定义了一个底栏: 导航图标是从“新矢量可绘制”向导生成的通用图标。有没有办法给它应用色调? 底部栏不是 Activity 操作栏。 到目前为止我已经尝试过: 应用了一个覆盖了 tex
我正在使用 BottomAppBar在我的应用程序中,但它有一个额外的左侧填充。如何删除此填充? 我的xml代码是:
我正在尝试实现 BottomAppBar 来处理 WebView 的导航。 一切正常,但我希望能够在用户分别向下和向上滚动时显示和隐藏 Bo
我目前正在开发一个使用底部应用栏作为主要导航的项目。但是即使我从示例源代码复制粘贴,我也总是会出错 这是我的布局文件 这是我的gradle依赖 depend
我有一个 Windows 8 应用程序(Xaml 和 C#): 我有一个包含在 MainPage 中的 userControl。 在这个 MainPage 中,我包含了一个 BottomAppBar,
class BottomNavigationDrawerFragment: BottomSheetDialogFragment(), NavigationView.OnNavigationIte
我像这样使用来自谷歌的 BottomAppBar: 自定义底栏是平的,我需要在底栏上添加圆角(如下图示例) 我应该怎么做才能使它以这种方式工作? 最佳答案 BottomAppBar 与 Mater
我想使用 CoordinatorLayout 在屏幕底部包含一个 BottomAppBar,并在剩余空间中显示一些内容(例如使用 ConstraintLayout)。 如果我将一个 Constrain
我刚刚开始使用 flutter,我想创建一个带有 FAB 和缺口的底部应用栏。 我的脚手架代码如下: return Scaffold( appBar: AppBar( ti
我正在使用最新的Material Design适用于 android 的库并遵循 this创建 BottomAppBar 的文档。 这是一个异常(exception)。完整日志为her
如何获取 BottomAppBar 的高度。我认为默认情况下它的高度为 8dp,但我没有得到任何高度。这是我的代码。 最佳答案 部分问题在于照明系统在 Android 上的工
我在应用程序中使用新的 BottomAppBar。但我无法让徽章发挥作用。我尝试使用 BottomNavigationView 上使用的相同逻辑,但它不起作用。(在另一个应用程序中,我在 Bottom
下面我有一张位图,不是纯白的,有一些噪点: 如何设置BottomAppBar的背景,下面是bitmap.xml, 在我的 activity_main.xml 中,我使用它如下: 但是不行,Bot
我正在尝试在 android 中实现 BottomAppBar 菜单小部件,但是在实现时我只能看到菜单图标而看不到所有其他菜单项(设置、搜索)。 我将父样式主题更改为:Theme.MaterialCo
我试图将 BottomAppBar 隐藏在键盘后面,但是当我将焦点转移到另一个 EditText 时,BottomAppBar 的部分开始出现,就像在photo .我也已经尝试更改 windowSof
我一直在尝试将菜单项的标题与 Android Studio 底部应用栏中的菜单图标一起添加。我尝试设置: app:showAsAction="ifRoom|withText" 但是没有成功。仅显示图标
我尝试了我的布局代码,BottomAppBar 没有完美显示,我到处搜索,但没有发现任何问题。 我在 Android Studio 3.4 上尝试过这个,我的 gradle 依赖项是 dependen
我尝试使用 BottomAppBar,我希望能够像 AppBarLayout 中的 setExpanded 一样以编程方式隐藏或显示它。 我的布局是这样的 ...
我是一名优秀的程序员,十分优秀!