Navigation drawer item icon not showing original colour

前端 未结 9 2189
一个人的身影
一个人的身影 2020-11-28 18:46

I\'m trying to show an icon next to an item within my menu for my navigation drawer, but for some reason the icon always appears in grey rather than the original colour (bro

9条回答
  •  温柔的废话
    2020-11-28 19:24

    I found the answer here: https://stackoverflow.com/a/30632980/875249

    To avoid the link its pretty straightforward:

        mNavigationView.setItemIconTintList(null);
    

    This disables all state based tinting, but you can also specify your own list too. It worked great for me!

    Here is where you can get the details on creating a color state list, but its pretty simple too: http://developer.android.com/reference/android/content/res/ColorStateList.html

        
            
            
        
    

提交回复
热议问题