How to style menu items in the navigation box in Android?

I want to add a style to the menu items inside the navigation box, but I cannot do this. I was looking for answers, but could not do it.

enter image description here

Can someone help, I would appreciate it.

I am using the following theme Theme.AppCompat.Light.DarkActionBar

<menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/group1" android:checkableBehavior="single"> <item android:title="Book Now!"> <menu> <item android:title="item 1" android:id="@+id/item1" android:icon="@drawable/ic_menu_gallery"/> <item android:title="item 2" android:id="@+id/item2" android:icon="@drawable/ic_menu_gallery"/> <item android:title="item 3" android:id="@+id/item3" android:icon="@drawable/ic_menu_gallery"/> <item android:title="item 4" android:id="@+id/item4" android:icon="@drawable/ic_menu_gallery"/> <item android:title="item 5" android:id="@+id/item5" android:icon="@drawable/ic_menu_gallery"/> </menu> </item> </group> </menu> 
+5
source share
2 answers

Step 1: Create a selector to change the 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 a selector to navigate the app object: itemTextColor

  <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" /> 
+3
source

Try using the new navigation box for Android Design, which is very smooth and easy to manage. Check out the link below:

http://www.android4devs.com/2014/12/how-to-make-material-design-navigation-drawer.html

-2
source

All Articles