I want to differentiate the groups by giving them a title or divider, but I can't find a title option for the group element.
Is there a way to add a title or divider?
<group android:id="@+id/menu_group_sort" > <item android:id="@+id/menu_sort_relevance" android:showAsAction="never" android:title="@string/sort_relevance"/> <item android:id="@+id/menu_sort_rating" android:showAsAction="never" android:title="@string/sort_rating"/> </group>
Click on the Screen Options drop-down at the top right of the screen. There will be many options that you can add to your menus. Some of the items are added by your plugins and can be disabled by simply unchecking any of the boxes you don't want. Check the Title Attribute box to add it to your menu items.
Creating a Menu Item Without a LinkIn your admin dashboard, go to Appearance > Menus. Under Add menu items, click on Custom Links. If you don't see this option, scroll to the top of the page and in the upper right corner look for Screen Options. Click on it, look for the Custom Links, and check this box.
Way to create menu directory and menu resource file: To create the menu directory just right-click on res folder and navigate to res->New->Android Resource Directory. Give resource directory name as menu and resource type also menu. one directory will be created under res folder.
I use this code for my project, take a look:
<item android:title="Search Option" android:id="@+id/menu_search_option" android:showAsAction="ifRoom|withText"> <menu> <group> <item android:id="@+id/menuSearchFilmEpisode" android:title="Episode"/> <item android:id="@+id/menuSearchActor" android:title="Actor"/> <item android:id="@+id/menuSearchDirector" android:title="Director"/> </group> </menu> </item>
And the result is that i have a group with text as icon on my action bar. Hope it helps.
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