右侧的BottomAppBar项目

时间:2018-10-30 11:17:23

标签: android android-bottomappbar

我想在中心模式下将BottomAppBarFAB一起使用。 我有4个项目要显示,并且想要像

一样拆分

this one

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

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

1 个答案:

答案 0 :(得分: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,请同时检查this tutorial