I have a standard Navigation Drawer, pre-created by Android Studio and want to populate it with number of groups. I started with this:
<?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_mode_person"
android:icon="@drawable/ic_person_black_24dp"
android:title="Person" />
<item
android:id="@+id/nav_mode_group"
android:icon="@drawable/ic_group_black_24dp"
android:title="Community" />
</group>
<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_menu_share"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="Send" />
</menu>
</item>
</menu>
But what I didn't get is if it even possible to give each group a title? I mean there is an android:title
option available for <item>
s, but it is unavailable for <group>
s and if I try to wrap groups around items, what I get is a messy entries behavior.
I read through Google's design guideline on Navigation Drawer, but missed the point if groups should have its own names or they should not. Here is a picture of what I want to achieve:
Is it possible without adding random <TextView>
s? By the way, I want to do it via XML, not programmatically.