Android BottomNavigationView不遵循布局继承人权限
我有一个底部导航视图,我想通过在它上面显示一个虚拟视图来隐藏它。在相对布局中,我将虚拟视图放置在底部导航视图的顶部。但底部导航视图始终显示在顶部。为什么底部导航视图不遵循布局层次结构Android BottomNavigationView不遵循布局继承人权限,android,androidx,android-bottomnav,android-bottomappbar,Android,Androidx,Android Bottomnav,Android Bottomappbar,我有一个底部导航视图,我想通过在它上面显示一个虚拟视图来隐藏它。在相对布局中,我将虚拟视图放置在底部导航视图的顶部。但底部导航视图始终显示在顶部。为什么底部导航视图不遵循布局层次结构 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <com.google.a
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:theme="@style/BottomBar"
android:visibility="visible"
app:itemTextAppearanceActive="@style/BottomNavigationViewTextStyle"
app:itemTextAppearanceInactive="@style/BottomNavigationViewTextStyle"
app:labelVisibilityMode="labeled"
app:menu="@menu/bottom_navigation_menu" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:background="@color/black" />
</RelativeLayout>
我希望视图显示在底部导航视图的顶部(以便底部导航视图不可见),但底部导航视图始终显示在顶部基于以下链接,底部导航视图的默认高程为8dp。更改虚拟布局的标高将解决此问题。发布屏幕截图。仅显示底部导航视图,不确定虚拟视图隐藏的原因。如果我删除虚拟视图,并通过添加一个以上父布局将其放置在相对布局之外,则会显示虚拟视图。请确保您的虚拟视图与底部导航视图具有更高或相等的高程。谢谢@Pawel。根据以下链接,底部导航视图的默认高程为8dp。更改高程应该可以解决此问题。