0

I want to set divider between these two items..

enter image description here

I tried to implement all solutions that I found in this site. But unfortunately I failed to make the divider line. Here is customerlist.xml file

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<group android:id="@+id/menuItem2">
    <item
        android:id="@+id/send"
        android:title="Send Profile">
    </item>
</group>

<group android:id="@+id/menuItem3">
    <item
        android:id="@+id/delete"
        android:title="Delete">
    </item>
</group>

Here is my style.xml file

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">#DFD6CB</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="android:itemTextAppearance">@style/customOptionsMenu</item>

</style>

<style name="customOptionsMenu" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Menu">
    <item name="android:textSize">13sp</item>
    <item name="android:textAllCaps">false</item>
</style>

And here is the code where I try to make divider line

    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)    {               
            PopupMenu popup = new PopupMenu(v.getContext(), v);
            popup.getMenuInflater().inflate(R.menu.customerlist_menu, menu);

            MenuCompat.setGroupDividerEnabled(popup.getMenu(), true);

        }

Can you give me a suitable solution ? Thank you.

thank you
  • 113
  • 8

0 Answers0