Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a title to my menu group

Tags:

android

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> 
like image 540
code511788465541441 Avatar asked Apr 06 '13 14:04

code511788465541441


People also ask

How to add a heading to a WordPress menu?

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.

How do I add a title to a Wordpress menu without linking?

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.

How do I create a menu and menu group?

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.


1 Answers

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.

like image 194
JJ86 Avatar answered Oct 17 '22 21:10

JJ86