Search code examples
androidandroid-layoutmaterial-designmenuitemdrawerlayout

How to add subtitle to material drawer layout?


I need to create material navigation drawer. I have already completed both header and menu with items. But I need to add this:

enter image description here

(in this example it is: " increase your limit") to the first item in drawer (this is just an design template).However, there is no parameter for aditional text...

My menu is in this typical format:

        <item
            android:id="@+id/blah"
            android:title="@string/blah"
            tools:icon="@drawable/blah" />

       <group
        android:id="@+id/drawer_group_primary"
        android:checkableBehavior="single">

        <item
            android:id="@+id/blah"

            android:title="@string/blah"
            tools:icon="@drawable/blah" />
        <item
            android:id="@+id/blah"
            android:title="@string/blah"
            tools:icon="@drawable/blah" />

        <item
            android:id="@+id/blah"
            android:title="@string/blah"
            tools:icon="@drawable/blah" />
        <item
            android:id="@+id/blah"
            android:title="@string/blah"
            tools:icon="@drawable/blah" />
    </group>

I can add additional layout to item, but it looks like this:example and i need to move that below title....


Solution

  • To achieve your desired layout, you should make changes in your nav_header.xml. You can customize nav_header as you want, because you can implement viewgroups and views beside menu..