I have an issue with my NavigationView
, when it's expanded the statusBar is shown in semitransparent color over it and i would hide it completely by still keeping notch support.
It looks like this now:
I've tried to add
android:fitsSystemWindows="false"
in my Activity but nothing chanded.
My styles.xml looks like this:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorAccent</item>
<item name="primaryTextColor">#F4F4F6</item>
<item name="colorControlNormal">@color/colorAccent</item>
<item name="secondaryTextColor">#96000000</item>
<item name="recyclerViewTitleColor">#96000000</item>
<item name="navColor">#2948ff</item>
<item name="colorTurni">@color/blueLight</item>
<item name="varianti">@color/green</item>
<item name="blueDark">@color/blueDark</item>
<item name="backgroundCardColor">#FFFF</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.App.BottomSheetDialog</item>
<item name="android:windowLayoutInDisplayCutoutMode">
shortEdges
</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
What i would reach is this:
Activity.xml
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FAFAFA"
android:orientation="vertical"
tools:context="it.gabtamagnini.visualposmobile.PtermActivity">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
...
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_menu"
android:layout_width="185dp"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:background="@color/white"
android:layout_gravity="start"
app:headerLayout="@layout/layout_header">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewMenu"
android:layout_width="match_parent"
android:layout_marginTop="120dp"
android:layout_height="match_parent"
tools:listitem="@layout/layout_menu"
android:clipToPadding="false"
android:paddingBottom="15dp"
android:paddingEnd="5dp"
android:paddingStart="5dp" />
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
This shadow is related to the drawable used for the inset foreground which is customized to R.styleable.ScrimInsetsFrameLayout_insetForeground
style by default on the NavigationView
; this answer explains more about the ScrimInsetsFrameLayout
class.
Getting rid of this drawable from the NavigationView
either programmatically or in layout:
Programmatically: setting setScrimInsetForeground
to null.
navView.setScrimInsetForeground(null)
In layout: using app:insetForeground="@null"
:
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_menu"
....
app:insetForeground="@null"/>