Adding Horizontal Divider to Menu Items (or Groups) in pure XML

196 Views Asked by At

I have created the following top-level main Menu in the Android app:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity">
        <group android:id="@+id/group_speed" android:checkableBehavior="single" >
            <item android:id="@+id/slow" android:title="@string/speed_slow"/>
            <item android:id="@+id/normal" android:title="@string/speed_normal"/>
            <item android:id="@+id/fast" android:title="@string/speed_fast" />
        </group>
        <group android:id="@+id/group_info" android:checkableBehavior="none">
            <item android:id="@+id/help" android:title="Help"/>
            <item android:id="@+id/about" android:title="About"/>
        </group>
</menu>

I would like to know if there is a simple way to add a Horizontal divider between two menu groups (and/or two menu items within the group) in a declarative way using just XML statement (optionally, adding shape resources, attributes, etc., but not using java code for this decorative task).

0

There are 0 best solutions below