I used app compat theme style .
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:popupMenuStyle">@style/PopupMenu</item>
<item name="android:itemTextAppearance">@style/myCustomMenuTextApearance</item>
<item name="android:listPopupWindowStyle">@style/PopupMenuStyle</item>
</style>
<style name="PopupMenuStyle" parent="Widget.AppCompat.ListPopupWindow">
<item name="android:divider">@drawable/devider</item>
<item name="android:dividerHeight">2dp</item>
</style>
<style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
<item name="android:popupBackground">@color/search_panel_color</item>
<item name="android:textColor">@color/activity_button_text_color</item>
<item name="android:shadowColor">@color/activity_theam_color</item>
</style>
<style name="myCustomMenuTextApearance" parent="@android:style/TextAppearance.Widget.TextView.PopupMenu">
<item name="android:textColor">@color/activity_theam_color</item>
</style>
I want to add a divider in my menu item. I've tried so many things, but the divider is not applying... Is there any way to show the divider?
I also have the same problem. The solution is like this:
<style name="PopupMenuListView" parent="@style/Widget.AppCompat.ListView.DropDown">
<item name="android:divider">#000000</item>
<item name="android:dividerHeight">1dp</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:dropDownListViewStyle">@style/PopupMenuListView</item>
</style>
You can also refer to the following link: How to add dividers between specific menu items?
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