Search code examples
androidandroid-layoutnavigation-drawerdrawerlayoutnavigationview

Different background colours in NavigationDrawer


Let's assume we have a basic Navigation Drawer such as we can generate by creating a new Navigation Drawer activity. We have default built items there. Is it possible to set different background colors in the navigation drawer for different items. For example as in photo: everything under Communicate should have grey background color. Any ideas?

Navigation Drawer

Greetings


Solution

  • If you want to change the text color: app:itemTextColor="@color/name_you_gave" or app:itemTextColor="#ffffff"

    If you want to change icon color: app:itemIconTint="@color/name_you_gave"

    If you want to change background color: android:background="@color/name_you_gave"

    Everything goes inside of NavigationView.