3

I used the Android Studio template for creating an app with NavigationDrawer, but want to change to dark theme. This works quite good, but I've got problems changing the color of the icons and selected icon of the drawer.

It's very similar to Change color of Navigation Drawer Icon in Android Studio default template but I additionally want to change the color of selected icons.

app:itemIconTint="@color/colorAccent" works at least in way that icons are not dark blue on dark background.

Is there a way to set different colors dependent on current state of the menu item (selected/not selected)?

Using a selector-drawable caused an exception while deflating the XML ("Binary XML file line #3: tag requires a 'android:color' attribute.").

Edit: SOLVED here: Change the color of a checked menu item in a navigation drawer

I've tried really many SO answers to similar or identical questions without success.

The point I struggled was that I used @drawable instead of @color. Didn't know @color resources can have multiple states as well.

Community
  • 1
  • 1
hgoebl
  • 12,637
  • 9
  • 49
  • 72
  • It sounds like you're looking for something like [this](http://stackoverflow.com/questions/30886453/change-the-color-of-a-checked-menu-item-in-a-navigation-drawer). **Edit:** That awkward moment when you paste the wrong link (sorry @hgoebl). – Patrick Apr 21 '16 at 17:30
  • @Patrick this exactly solved the problem. If you don't mind, I'd delete the question since it's a duplicate. – hgoebl Apr 21 '16 at 18:55
  • **Edit** changed my mind. Maybe somebody finds the right solution through this post. It's really a nasty problem... – hgoebl Apr 21 '16 at 19:01

0 Answers0