How to style Menu Items in Navigation Drawer in Android? How to style Menu Items in Navigation Drawer in Android? android android

How to style Menu Items in Navigation Drawer in Android?


Step 1: Create Selector for change font color

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">    <item android:color="@color/red" android:state_checked="true" />    <item android:color="#bdbdbd" /></selector>

Step 2: Apply selector to navigation view by app:itemTextColor property

 <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:background="@color/appColor"        android:fitsSystemWindows="true"                                       app:itemTextAppearance="@style/NavigationDrawerStyle"        app:headerLayout="@layout/nav_header_home"        app:itemBackground="@color/appColor"        app:itemTextColor="@color/drawable_selector_drawer_item"        app:menu="@menu/activity_home_drawer" />