MenuUtils

Added in API level XE12

A collection of extensions for Menu and related classes.

Public Methods
static void
setDescription(MenuItem item, CharSequence description)
static void
setDescription(MenuItem item, int description)
static void
Inherited Methods

Public Methods

Added in API level XE12

public static void setDescription (MenuItem item, CharSequence description)

Sets an additional description text on a menu item.

The description attribute can only be set through this method. The attribute is not supported in XML.

Parameters
item the menu item
description additional description text
Throws
RuntimeException if item is not a concrete implementation
Added in API level XE12

public static void setDescription (MenuItem item, int description)

Sets an additional description text on a menu item.

The description attribute can only be set through this method. The attribute is not supported in XML.

Parameters
item the menu item
description additional description text (as a resource ID)
Throws
RuntimeException if item is not a concrete implementation
Added in API level XE12

public static void setInitialMenuItem (Menu menu, MenuItem item)

Sets the initial menu item when users open a menu.

By default, the first menu item appears with all the other items to the right. This method lets you set another menu item to initially show, and other items can potentially appear to the left or right of the item that is initially shown.

Parameters
menu the menu on which preferred initial menu item should be set
item the preferred initial menu item. If this item cannot be found, the menu falls back to the default behavior
Throws
RuntimeException if menu is not a concrete implementation