Android support design library provide NavigationView:
<android.support.design.widget.NavigationView ... app:menu="@menu/navigation_drawer_items" />
menu/navigation_drawer_items:
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item .../> ... </group> <group android:checkableBehavior="single"> <item .../> ... </group> </menu>
How to add divider, separator or space between groups (like on picture)?
Just give a unique id to each group. It will create a separator automatically.
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/group_feature" android:checkableBehavior="single"> <item android:id="@+id/navdrawer_item_map" android:checked="true" android:icon="@drawable/ic_drawer_map" android:title="@string/navdrawer_item_map"/> </group> <group android:id="@+id/group_settings" android:checkableBehavior="single"> <item android:id="@+id/navdrawer_item_settings" android:icon="@drawable/ic_drawer_settings" android:title="@string/navdrawer_item_settings"/> </group> </menu>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With