Tutorial by Examples

In Android there is a default options menu, which can take a number of options. If a larger number of options needs to be displayed, then it makes sense to group those options in order to maintain clarity. Options can be grouped by putting dividers (i.e. horizontal lines) between them. In order to a...
public static void applyFontToMenu(Menu m, Context mContext){ for(int i=0;i<m.size();i++) { applyFontToMenuItem(m.getItem(i),mContext); } } public static void applyFontToMenuItem(MenuItem mi, Context mContext) { if(mi.hasSubMenu()) for(int i=0;i<mi.getSubMenu...
To define your own menu, create an XML file inside your project's res/menu/ directory and build the menu with the following elements: <menu> : Defines a Menu, which holds all the menu items. <item> : Creates a MenuItem, which represents a single item in a menu. We can also create a n...

Page 1 of 1