将Design.Widget.BottomNavigationView放置在Relativelayout的底部



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

中的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>

上面是我的代码的典型显示,但底部导航视图并不对准底部。考虑上述片段,请如何将底部导航视图放在我的活动

的底部

layout_gravity属性更改为BottomNavigationViewandroid:layout_alignParentBottom="true"

您必须添加

        android:layout_alignParentBottom="true"

到您的底部navigationView