How to change the text and icon color of selected menu item on Navigation Drawer programmatically using java

前端 未结 5 994
栀梦
栀梦 2020-12-14 01:44

I am a beginner in Android Development. Using android\'s default Navigation drawer activity I am developing an application. One of the requirements of this app is to change

5条回答
  •  被撕碎了的回忆
    2020-12-14 02:44

    First check for the NavigationView below

    
    

    Check here two things

    app:itemIconTint="@drawable/drawer_item_color"
    app:itemTextColor="@drawable/drawer_item_color"
    

    These both tags are using drawer_item_color.xml which is a selector in drawable folder and below is the code for it

    
    
        
        
    
    

    use selector and add colors you want. This will do the job for you.

提交回复
热议问题