Android 12 Developer Preview is here! Try it out, and give us your feedback!

MenuItemCompat

class MenuItemCompat
kotlin.Any
   ↳ androidx.core.view.MenuItemCompat

Helper for accessing features in android.view.MenuItem.

Note: You cannot get an instance of this class. Instead, it provides static methods that correspond to the methods in , but take a android.view.MenuItem object as an additional argument.

Summary

Nested classes
abstract

Interface definition for a callback to be invoked when a menu item marked with is expanded or collapsed.

Constants
static Int

Always show this item as a button in an Action Bar.

static Int

This item's action view collapses to a normal menu item.

static Int

Show this item as a button in an Action Bar if the system decides there is room for it.

static Int

Never show this item as a button in an Action Bar.

static Int

When this item is in the action bar, always show it with a text label even if it also has an icon specified.

Public methods
static Boolean

Collapse the action view associated with this menu item.

static Boolean

Expand the action view associated with this menu item.

static ActionProvider!

Gets the ActionProvider.

static View!

Returns the currently set action view for this menu item.

static Int

Return the modifier for this menu item's alphabetic shortcut.

static CharSequence!

Retrieve the content description associated with this menu item.

static ColorStateList!

static Mode!

Returns the blending mode used to apply the tint to the item's icon, if specified.

static Int

Return the modifiers for this menu item's numeric (12-key) shortcut.

static CharSequence!

Retrieve the tooltip text associated with this menu item.

static Boolean

Returns true if this menu item's action view has been expanded.

static MenuItem!

Sets the ActionProvider responsible for creating an action view if the item is placed on the action bar.

static MenuItem!
setActionView(item: MenuItem!, view: View!)

Set an action view for this menu item.

static MenuItem!
setActionView(item: MenuItem!, resId: Int)

Set an action view for this menu item.

static Unit
setAlphabeticShortcut(item: MenuItem!, alphaChar: Char, alphaModifiers: Int)

Change the alphabetic shortcut associated with this item.

static Unit
setContentDescription(item: MenuItem!, contentDescription: CharSequence!)

Change the content description associated with this menu item.

static Unit

Applies a tint to the item's icon.

static Unit
setIconTintMode(item: MenuItem!, tintMode: Mode!)

Specifies the blending mode used to apply the tint specified by setIconTintList(MenuItem, ColorStateList) to the item's icon.

static Unit
setNumericShortcut(item: MenuItem!, numericChar: Char, numericModifiers: Int)

Change the numeric shortcut and modifiers associated with this item.

static MenuItem!