Reputation: 41
I write the following menu XML to create 2 groups submenu, I want items within each group to be single checkable but not all/multi checkable, don't know why the menu comes out always as "all/multi" checkable:
<item android:title="Color">
<menu>
<group android:id="@+id/ColorMenuGroup" android:checkableBehavior="single">
<item
android:id="@+id/Black"
android:title="@string/black" />
<item
android:id="@+id/Blue"
android:title="@string/blue" />
<item
android:id="@+id/Red"
android:title="@string/red" />
</group>
</menu>
</item>
<item android:title="Width">
<menu>
<group android:id="@+id/WidthMenuGroup" android:checkableBehavior="single">
<item
android:id="@+id/Width1"
android:title="@string/_1"
<item
android:id="@+id/Width3"
android:title="@string/_3"
<item
android:id="@+id/Width5"
android:title="@string/_5"
</group>
</menu>
</item>
Upvotes: 3
Views: 712
Reputation: 69
I faced the same issue.
My work around is to uncheck the previous item manually.
OnNavigationItemSelectedListener { item ->
previousDrawerItem!!.isChecked = false
return@OnNavigationItemSelectedListener true
Upvotes: 1