Currently my menu looks black like the following image
And I would like it to be white, my xml is as follows:
<android.support.v4.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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="330dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"
android:background="@color/white"
app:itemIconTint="@color/black"
/>
The back end is as follows
public void MenuConfiguracion() {
Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar_toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.bringToFront();
drawer.requestLayout();
final ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
navigationView.bringToFront();
navigationView.requestLayout();
}
The truth is that I don't realize where this color is set, I already tried changing my THEME, from Light to DarkLight as I saw in some questions but it didn't work for me,
I add new style
<style name="AppThemeMenu" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
in the XML
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="330dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"
android:background="@color/white"
android:theme="@style/AppThemeMenu"
app:itemIconTint="@color/black"
/>
One option is to define the color in a style, inside
styles.xml
(there may be several in your project), add the named styleDrawerIcon
and define the color white:then check which theme uses the Activity that contains the
NavigationDrawer
inside yourAndroidManifest.xml
(android:theme="???"
) and add the style to this themeDrawerIcon
.For example if your application uses the style
AppTheme
then here I must define the styleDrawerIcon
:Based on the above you can easily change the color of the "hamburger" icon:
It works for me over writing the secondary text color in the toolbar theme
This goes in styles.xml
The first thing is to identify which is the style that drags you
ToolBar
or the activity where it isToolBar
and place this lineFont
https://www.flipandroid.com/how-to-change-the-color-of-the-hamburger-icon-in-the-material-design-navigation-drawer.html