Android 是否有将浮动操作按钮与底部导航视图相结合的库?

Android 是否有将浮动操作按钮与底部导航视图相结合的库?,android,Android,我想要得到的是: 我得到的 如何达到预期的效果?我使用以下代码: 在下面的代码中实现您的代码。有关更多说明,请参见设计文档。 您可以使用以下内容: <com.google.android.material.bottomappbar.BottomAppBar android:id="@+id/bottom_app_bar" android:layout_width="match_parent" android:layout_height="wrap_

我想要得到的是: 我得到的 如何达到预期的效果?我使用以下代码:


在下面的代码中实现您的代码。有关更多说明,请参见设计文档。

您可以使用以下内容:

  <com.google.android.material.bottomappbar.BottomAppBar
      android:id="@+id/bottom_app_bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      app:fabCradleVerticalOffset="0dp"
      app:fabCradleRoundedCornerRadius="0dp"
      app:fabCradleMargin="0dp"
      app:contentInsetStart="0dp"
      >

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:menu="@menu/...."
        android:layout_gravity="bottom"
      />

  </com.google.android.material.bottomappbar.BottomAppBar>


  <com.google.android.material.floatingactionbutton.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_anchor="@id/bottom_app_bar"
      android:layout_gravity="bottom|center"
      />


在BottomAppBar中使用BottomNavigationView不要在堆栈溢出时询问库,您的问题将作为非主题结束,我将其从原始问题中删除,因为您确实描述了所需的结果以及您迄今为止为实现该结果所做的努力,这是一个有效的问题,以后不要再问库了:)将fab锚定到底部_栏而不是导航视图如果我将fab锚定到底部_栏fab在屏幕开始时走在导航视图前面我从这段代码开始,但浮动按钮高于导航栏,但我需要靠近屏幕边缘,检查预览您应该根据需要使用边距设置FAB。我会尽快尝试,并回答helpedI是否复制了您的代码,但这与我需要的不同,FAB高于模板,我需要它更靠近屏幕边缘
  <com.google.android.material.bottomappbar.BottomAppBar
      android:id="@+id/bottom_app_bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      app:fabCradleVerticalOffset="0dp"
      app:fabCradleRoundedCornerRadius="0dp"
      app:fabCradleMargin="0dp"
      app:contentInsetStart="0dp"
      >

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:menu="@menu/...."
        android:layout_gravity="bottom"
      />

  </com.google.android.material.bottomappbar.BottomAppBar>


  <com.google.android.material.floatingactionbutton.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_anchor="@id/bottom_app_bar"
      android:layout_gravity="bottom|center"
      />