Ich bin ein Android-Anwendung entwickeln, ich habe eine Navigationsleiste anpassen, dann ist dies der Code, den ich benutze:Benutzerdefinierte Farbe in Navigationsleiste in Android
<?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>
Dies wird er Schublade 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>
Dies ist der 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);
ich die Navigationsleiste anpassen müssen, um den Hintergrund der Etikett muss "Gold" sein der Artikel "weiß".
Wie kann ich das tun?