I'm developing an Android application, I have to customize a navigation drawer, this is the code that i use :
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:title="Discover"> <--- LABEL
<menu>
<item
android:id="@+id/nav_qrcode" <--- Item of menu
android:icon="@drawable/read_qr"
android:title="Read QRCode" />
<item
android:id="@+id/nav_favorite" <--- Item of menu
android:icon="@drawable/favorite"
android:title="Favorite" />
</menu>
</item>
</menu>
This is he drawer layout:
<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="true"
android:background="@color/gold"
app:itemTextColor="@color/white"
app:menu="@menu/main_drawer" />
</android.support.v4.widget.DrawerLayout>
This is the java code:
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
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.setItemIconTintList(null);
I have to customize the navigation drawer, the background of the label must be "gold" the item "white".
How i can do this ?