混合底部应用栏和浮动操作按钮 (FAB)

Mixing bottom app bar and floating action button (FAB)

我想使用 BottomNavigation and FloatingActionButton at the same time in Android and there is nothing like this in google material components 而且我也没有找到任何第三方库可以实现类似的功能。附加的 GIF 演示了我想要实现的内容。 In fact I want a bottom navigation that one of its tabs has a FAB which placed on the navigation bar and the FAB disappears when another tab is selected.

See the attached image here.

您不会在您的示例中为布局找到 Material 组件,因为它与 Material Design Spec 相反。

Floating Action Button (FAB) represents the primary action of a screen

该示例将提供多个 "primary" 交互,因为它与导航混合在一起。我不建议在底部导航栏的上下文中使用 FAB。相反,为了用户的利益,通过将 FAB 向上移动到页面右侧,在视觉上将它们分开。这是 Extending the FAB

的 Material 文档

现在您 没有遵循 Material 规范 但是 您不应该期望预先构建 Material 组件忽略它。