将 design.widget.BottomNavigationView 放置到相对布局的底部

ble*_*end 1 xml android android-layout

我一直在努力将底部导航视图放置到底部。它没有定位到底部。底部导航视图放置在带有按钮的相对布局内。这是文件中的xml代码

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">



    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        app:menu="@menu/navigation" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

以上是我的代码的典型展示,但底部导航视图未与底部对齐。考虑到上述片段,请问如何将底部导航视图放置在我的活动的底部

Aal*_*tel 6

layout_gravity将属性更改android:layout_alignParentBottom="true"为您的BottomNavigationView.