使用下面的代码并使用相对布局而不是线性布局。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/nav_view"
android:background="#6000BCD4"
app:elevation="4dp"
app:labelVisibilityMode="auto"
app:itemHorizontalTranslationEnabled = "false"
android:layout_alignParentBottom="true"
app:itemIconSize="23sp"
app:menu="@menu/bottom_nav_menu"/>
</RelativeLayout>