NavigationView: how to insert divider without subgroup?

All you need to do is define a group with an unique ID. I looked through NavigationView‘s implementation, and it will create a divider every time the group id is changed.

e.g.

<group android:id="@+id/my_id">
    <!-- Divider will appear above this item -->
    <item ... />
</group>

Leave a Comment