How to add line divider for menu item Android
Make sure to call MenuCompat.setGroupDividerEnabled(menu, true); when you inflate your menu, otherwise groups will not be separated by divider! Example: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_activity_main, menu); MenuCompat.setGroupDividerEnabled(menu, true); return true; } And make sure to have different groups in your menu xml, e.g.: <menu> <group android:id=”@+id/sorting” > <item android:id=”@+id/action_sorting_new_old” android:title=”@string/action_sorting_new_old”/> <item android:id=”@+id/action_sorting_a_z” android:title=”@string/action_sorting_a_z”/> … Read more