打开幻灯片菜单时隐藏底部导航视图

hiding bottom navigation view when open slide menu

我的项目中有一个 bottom navigation view,其中有 2 个 fragments,每个片段都有一个 slide menu (navigation view),我想隐藏 bottom navigation view 当我的任何菜单显示时,有人能给我一个例子吗?如果有类似的问题,如果你能给我看,我会很高兴,因为我没有找到类似的东西

如果您的布局是这样的:

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
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:id="@+id/drawer_layout"
tools:openDrawer="start"
android:layout_height="match_parent"
tools:context=".MainActivity">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_height="?attr/actionBarSize">
<com.google.android.material.bottomnavigation.BottomNavigationView
    android:layout_alignParentBottom="true"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    app:menu="@menu/buttom_nav_menu"/>
</RelativeLayout>

<com.google.android.material.navigation.NavigationView
    android:layout_gravity="start"
    app:menu="@menu/menu"
    android:layout_width="330dp"
    android:layout_height="match_parent"/>

</androidx.drawerlayout.widget.DrawerLayout>

您不需要隐藏 bottom navigation view 因为幻灯片菜单在它前面