Elements and Attributes

All attributes must be defined with the android namespace (e.g., android:icon="@drawableAcon"). <menu>

The root of a menu. Contains <item> and <group> nodes. No attributes. <group>

A menu group. Contains <item> elements. Valid attributes:

• menuCategory - Value corresponding to Menu CATEGORY_* constants — defines the priority of the group. Valid values: container, system, secondary, and alternative.

• orderInCategory - An integer that defines the default order of the items within the category.

• checkableBehavior - Whether the items are checkable. Valid values: none, all (exclusive / radio buttons), single (non-exclusive / checkboxes)

• visible - Whether the group is visible. true or false.

• enabled - Whether the group is enabled. true or false.

A menu item. May contain a <menu> element (for a Sub Menu). Valid attributes:

• menuCategory - Used to define the menu category.

• orderInCategory - Used to define the order of the item, within a group.

• titleCondensed - A condensed string title, for situations in which the normal title is too long.

• icon - A resource identifier for a drawable icon.

• alphabeticShortcut - A character for the alphabetic shortcut key.

• numericShortcut - A number for the numeric shortcut key.

• checkable - Whether the item is checkable. true or false.

• checked - Whether the item is checked by default. true or false.

• visible - Whether the item is visible by default. true or false.

• enabled - Whether the item is enabled by default. true or false.

For more discussion on how to create menus in XML and inflate them in your application, read Creating Menus.

0 0

Post a comment