Navigation Drawer item background colour for selected item

后端 未结 13 1558
独厮守ぢ
独厮守ぢ 2020-11-28 23:54

I used Android Studio to implement the Navigation Drawer and I can\'t get the blue colour that is used to show which section we\'re currently in to change.

I\'ve tri

13条回答
  •  感动是毒
    2020-11-29 00:13

    This worked for me : implemented menu drawer not by populating the navigation view with list, but with menu items.

    created a drawable like this :

    
    
    
    

    and in onCreate method , set the id of the menu item which corresponds to selected activity as checked. and implement the drawable selector file to your navigation drawer like this

        app:itemBackground="@drawable/drawer_menu_selector"
    

    fyi : need to define your 'app' namespace.

提交回复
热议问题