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


i want add style menu items inside navigation drawer unable so. have looked answers couldn't done it.

enter image description here

can help, grateful.

i using 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> 

step 1: create selector 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 navigation view 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" /> 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -