我正在使用 Jetpack Compose 构建 Android 应用程序。在尝试使用 BottomDrawer 模式实现 BottomAppBar 时遇到了困难。
Bottom navigation drawers are modal drawers that are anchored to the bottom of the screen instead of the left or right edge. They are only used with bottom app bars. These drawers open upon tapping the navigation menu icon in the bottom app bar.
material.io 的说明,和direct link to video .
我尝试过使用Scaffold,但它只支持侧抽屉。附加到 Scaffold 内容的 BottomDrawer 将显示在内容区域中,并且 BottomDrawer 打开时不会覆盖 BottomAppBar。在 Scaffold 函数之后移动 BottomDrawer 也没有帮助:BottomAppBar 被一些不可见的 block 覆盖并阻止单击按钮。
我也尝试过使用 BottomSheetScaffold,但它没有 BottomAppBar 插槽。
如果 Scaffold 不支持这种模式,那么正确的实现方法是什么?是否可以扩展 Scaffold 组件?我担心当我尝试实现导航和 snackbar 时,从头开始的错误实现可能会产生问题。
最佳答案
我认为最新版本的脚手架确实有一个底部应用栏参数
关于android - 如何使用 Android Jetpack Compose 实现 BottomAppBar 和 BottomDrawer 模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67854169/