目录
1.问题描述
(1)主页面已经沉浸状态栏,侧滑抽屉跟随拖动,出现半透明状态
(2)当前布局
(3)默认设置前景半透明
<!--侧滑抽屉内容-->
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/drawer_item_bg_n"
android:fitsSystemWindows="true"
app:headerLayout="@layout/index_drawer_header_item"
app:itemBackground="@drawable/drawer_item_bg"
app:menu="@menu/index_menu_drawer_item" />
2.解决问题
(1)手动设置前景全透明:app:insetForeground="@android:color/transparent"
<!--侧滑抽屉内容-->
<com.google.android.material.navigation.NavigationView
app:insetForeground="@android:color/transparent"
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/drawer_item_bg_n"
android:fitsSystemWindows="true"
app:headerLayout="@layout/index_drawer_header_item"
app:itemBackground="@drawable/drawer_item_bg"
app:menu="@menu/index_menu_drawer_item" />
(2)NavigationView全透明
3.疑惑
***模拟器运行,看不见半透明状态,全面屏真机看得见,并用方案实现想要的效果***