Navigation Drawer selected item not showing background color for second group of items

Viewed 935

I have a navigation drawer in my android app, which works fine. The only problem I'm having is, that the gray selection background color of an item does not change whenever I click on a menu item from my secound group of menu items.

Here is a screenshot of my nav drawer: enter image description here

The background color switches whenever I'm selecting an item from the first group, but not when I select one from the second group of items.

Here is my XML-File for the menu:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group android:checkableBehavior="single">
            <item
                android:id="@+id/nav_compare"
                android:icon="@drawable/ic_menu_compare"
                android:title="@string/nav_item_compare"
                android:checked="true"/>
            <item
                android:id="@+id/nav_data"
                android:icon="@drawable/ic_menu_data"
                android:title="@string/nav_item_data" />
            <item
                android:id="@+id/nav_add_data"
                android:icon="@drawable/ic_menu_add_data"
                android:title="@string/nav_item_add_data" />
            <item
                android:id="@+id/nav_favorites"
                android:icon="@drawable/ic_menu_favorites"
                android:title="@string/nav_item_favorites" />
            <item
                android:id="@+id/nav_categories"
                android:icon="@drawable/ic_menu_categories"
                android:title="@string/nav_item_categories" />
            <item
                android:id="@+id/nav_submit_data"
                android:icon="@drawable/ic_menu_submit_data"
                android:title="@string/nav_item_submit_data" />
    </group>

    <item android:title="@string/navigation_second_group_title">
        <menu>
            <item
                android:id="@+id/nav_settings"
                android:icon="@drawable/ic_menu_settings"
                android:title="@string/nav_item_settings" />
            <item
                android:id="@+id/nav_about"
                android:icon="@drawable/ic_menu_about"
                android:title="@string/nav_item_about" />
            <item
                android:id="@+id/nav_help"
                android:icon="@drawable/ic_menu_help"
                android:title="@string/nav_item_help" />
        </menu>
    </item>
</menu>

And here is the Navigation Drawer in my main XML File:

<android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/act_main_nav_drawer_header"
        app:menu="@menu/activity_main_drawer" />

Any help would be appreciated, I couldn't find the same issue on google.

1 Answers
Related