I have a problem changing the Menu Item Title Color
in the Navigation Drawer
I set the itemTextColor
but it only changes the Color
of the Items not the Title
of the menu.
Here is my Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<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"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"
app:itemTextColor="#ffffff"
android:background="#283135"
/>
</android.support.v4.widget.DrawerLayout>
activity_main_drawer.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_home"
android:icon="@mipmap/hospital"
android:title="Home"
/>
<item
android:id="@+id/nav_reminder"
android:icon="@mipmap/alarm"
android:title="Reminders" />
</group>
<item android:title="Tools">
<menu>
<item
android:id="@+id/nav_settings"
android:icon="@mipmap/settings"
android:title="Settings" />
<item
android:id="@+id/nav_help"
android:icon="@mipmap/information"
android:title="Help" />
<item
android:id="@+id/nav_about"
android:icon="@mipmap/team"
android:title="About Us" />
</menu>
</item>
</menu>
You can also define new style in styles.xml:
and then applying this style in NavigationView's theme:
Set textSize if you want to change the title size too
To give
Menu
itemtitle
color
andtextSize
Create this way..add this to your
styles.xml
file.now in
activity_main_drawer.xml
file giveid
attribute
totitle
..now In
MainActivity.java
file use this way..It will change your
tools
color
toRed
andTextSize
to20sp
.. Implement it..In my case Output :