4

我想在中心模式下使用BottomAppBara 。FAB我有 4 个项目要显示并想拆分

这个

那可能吗 ?如果是这样:如何?

编辑:我在这里找到了解决方案:How to make Bottom AppBar like Google Home App?

4

1 回答 1

0

您需要在您的 xml 中添加带有 fab 的底部栏,如下所示

<com.google.android.material.bottomappbar.BottomAppBar
      android:id="@+id/bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      app:fabAlignmentMode="center"
      app:fabAttached="true"
      app:navigationIcon="@drawable/ic_menu_24"/>

  <com.google.android.material.floatingactionbutton.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_anchor="@id/bar"/>

如果你想知道如何设置你的bottomappbar,也可以查看本教程

于 2018-10-30T11:24:36.303 回答