英文:
hiding bottom navigation view when open slide menu
问题
我在项目中有一个带有2个“底部导航视图”的布局,并且每个片段都有一个“侧滑菜单”(导航视图),我希望在任何一个菜单显示时隐藏“底部导航视图”,有人可以给我一个示例该如何做吗?如果有类似的问题,如果您能展示给我,我会很高兴,因为我没有找到类似的内容。
英文:
I have a bottom navigation view
in my project with 2 fragments
and every fragment has a slide menu
(navigation view
) and I want to hide the bottom navigation view
when any of my menus is showing,can someone give me an example how to do that?and if there is a similar question, I would be glad if you would show me it, because I have not found anything similar
答案1
得分: 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
,因为滑动菜单位于其前方。
英文:
if your layout like this :
<?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>
you will not need to hide the bottom navigation view
because the slide menu is in front of it
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论