Navigation Drawer item background colour for selected item

后端 未结 13 1509
独厮守ぢ
独厮守ぢ 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:27

    To solve this problem:

    1- You don't need android:listSelector under your ListView.

    2- Open (or Create) styles.xml under (res/values).

    
    
    

    3- Under res/drawable folder create drawer_list_selector.xml file

    
        
        
        
    
    

    4- Under res/drawable create red_color.xml / light_gray_color.xml (or any other name) and add your desired Hex color:

    
    
        
    
    

    5- Open your project AndroidManifest.xml and add android:theme tag (if not exist)

    
    

    Reference / Credit: Changing Navigation Drawer Selected Item Color from default blue

提交回复
热议问题