应用程序布局上的底部导航栏覆盖。我不想隐藏导航栏。应用程序布局上的底部导航栏覆盖
使用RelativeLayout作为父布局并使用此属性
android:layout_below="@+id/aboveElement"
例如
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".activity.HomeScreen">
<fragment
android:id="@+id/my_nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomNav"
android:layout_below="@+id/topLinearHome"
app:defaultNavHost="true"
app:navGraph="@navigation/bottom_navigation" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNav"
android:layout_width="match_parent"
android:layout_height="@dimen/_50sdp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="#FFF"
android:elevation="0dp"
app:itemIconSize="@dimen/_20sdp"
app:menu="@menu/bottom_menu" />
</RelativeLayout>