Reputation: 549
How can I remove the primary color from the below drawer?
I tried to remove the header items from the drawer but the above selected color still remains.
Upvotes: 1
Views: 925
Reputation: 1730
The earlier answer might work too, but it feels that it's too much compared to what you want to achieve. You can just change the navigation view such that it doesn't draw over the statusbar.
In your activity_main.xml
change the android:fitsSystemWindows
of the NavigationView element to false
. Doing this will give you the desired result.
Thus the codeblock will look like this:
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="false"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"/>
Upvotes: 0
Reputation: 1060
try to set navigation drawer padding Top 20dp/24dp and create navigation drawer background like this.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="20dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/white"/>
</shape>
</item>
and set navigation drawer file
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:paddingTop="20dp"
android:fitsSystemWindows="false"
android:background="@drawable/menu_navigation"
app:headerLayout="@layout/nav_header_home"
app:menu="@menu/activity_home_drawer" />
Upvotes: 1