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

时间:2020-09-13 16:20:42

标签: java android-studio bottomnavigationview

我的项目中有一个bottom navigation view,其中有2个fragments,每个片段都有一个slide menunavigation view),我想在{我的任何菜单都在显示,有人可以给我一个例子怎么做?如果有类似的问题,我很高兴您能显示给我,因为我还没有找到类似的东西

1 个答案:

答案 0 :(得分:0)

如果您的布局是这样的:

<?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,因为幻灯片菜单位于其前面