# MenuItemCompat

# MenuItemCompat

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/MenuItemCompat.java+class:androidx.core.view.MenuItemCompat)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/view/MenuItemCompat "View this page in Java")

<br />

```
class MenuItemCompat
```

<br />

*** ** * ** ***

Helper for accessing features in[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html).

**Note:** You cannot get an instance of this class. Instead, it provides*static* methods that correspond to the methods in[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html), but take a[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)object as an additional argument.

## Summary

|                                                                                                                                                                ### Nested types                                                                                                                                                                |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `interface `[MenuItemCompat.OnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat.OnActionExpandListener) **This interface is deprecated.** Use[MenuItem.OnActionExpandListener](https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener.html)directly. <br /> |

|                                    ### Constants                                    |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [SHOW_AS_ACTION_ALWAYS](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_ALWAYS())` = 2` **This property is deprecated.** Use[SHOW_AS_ACTION_ALWAYS](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_ALWAYS())directly. <br />                                                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW())` = 8` **This property is deprecated.** Use[SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW())directly. <br /> |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [SHOW_AS_ACTION_IF_ROOM](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_IF_ROOM())` = 1` **This property is deprecated.** Use[SHOW_AS_ACTION_IF_ROOM](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_IF_ROOM())directly. <br />                                                     |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [SHOW_AS_ACTION_NEVER](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_NEVER())` = 0` **This property is deprecated.** Use[SHOW_AS_ACTION_NEVER](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_NEVER())directly. <br />                                                             |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [SHOW_AS_ACTION_WITH_TEXT](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_WITH_TEXT())` = 4` **This property is deprecated.** Use[SHOW_AS_ACTION_WITH_TEXT](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_WITH_TEXT())directly. <br />                                             |

|                                                ### Public functions                                                 |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                   | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "item.collapseActionView()")` ~~[collapseActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#collapseActionView(android.view.MenuItem))~~`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!)` **This function is deprecated.** Use[collapseActionView](https://developer.android.com/reference/android/view/MenuItem.html#collapseActionView())directly. <br />                                                                                                                                                                       |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                   | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "item.expandActionView()")` ~~[expandActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#expandActionView(android.view.MenuItem))~~`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!)` **This function is deprecated.** Use[expandActionView](https://developer.android.com/reference/android/view/MenuItem.html#expandActionView())directly. <br />                                                                                                                                                                                 |
| `java-static `[ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider)`?` | [getActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getActionProvider(android.view.MenuItem))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`)` Gets the[ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider).                                                                                                                                                                                                                                                                                                                                                                                 |
| `java-static `[View](https://developer.android.com/reference/android/view/View.html)`!`                             | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "item.getActionView()")` ~~[getActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getActionView(android.view.MenuItem))~~`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!)` **This function is deprecated.** Use[getActionView](https://developer.android.com/reference/android/view/MenuItem.html#getActionView())directly. <br />                                                                                                                                                                                                |
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                           | [getAlphabeticModifiers](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getAlphabeticModifiers(android.view.MenuItem))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`)` Return the modifier for this menu item's alphabetic shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `java-static `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?`     | [getContentDescription](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getContentDescription(android.view.MenuItem))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`)` Retrieve the content description associated with this menu item.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `java-static `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?`  | [getIconTintList](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getIconTintList(android.view.MenuItem))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`)`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `java-static `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?`   | [getIconTintMode](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getIconTintMode(android.view.MenuItem))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`)` Returns the blending mode used to apply the tint to the item's icon, if specified.                                                                                                                                                                                                                                                                                                                                                                                                              |
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                           | [getNumericModifiers](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getNumericModifiers(android.view.MenuItem))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`)` Return the modifiers for this menu item's numeric (12-key) shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `java-static `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?`     | [getTooltipText](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getTooltipText(android.view.MenuItem))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`)` Retrieve the tooltip text associated with this menu item.                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                   | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "item.isActionViewExpanded()")` ~~[isActionViewExpanded](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#isActionViewExpanded(android.view.MenuItem))~~`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!)` **This function is deprecated.** Use[isActionViewExpanded](https://developer.android.com/reference/android/view/MenuItem.html#isActionViewExpanded())directly. <br />                                                                                                                                                             |
| `java-static `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`?`                     | [setActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionProvider(android.view.MenuItem,androidx.core.view.ActionProvider))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`, provider: `[ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider)`?)` Sets the[ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider)responsible for creating an action view if the item is placed on the action bar.                                                                                                                                               |
| `java-static `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!`                     | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "item.setActionView(resId)")` ~~[setActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionView(android.view.MenuItem,int))~~`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!, resId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.** Use[setActionView](https://developer.android.com/reference/android/view/MenuItem.html#setActionView(int))directly. <br />                                                                                              |
| `java-static `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!`                     | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "item.setActionView(view)")` ~~[setActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionView(android.view.MenuItem,android.view.View))~~`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!, view: `[View](https://developer.android.com/reference/android/view/View.html)`!)` **This function is deprecated.** Use[setActionView](https://developer.android.com/reference/android/view/MenuItem.html#setActionView(android.view.View))directly. <br />                                                                        |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | [setAlphabeticShortcut](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setAlphabeticShortcut(android.view.MenuItem,char,int))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`, alphaChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)`, alphaModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Change the alphabetic shortcut associated with this item.                                                                                                                                                                                                                       |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | [setContentDescription](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setContentDescription(android.view.MenuItem,java.lang.CharSequence))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`, contentDescription: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?)` Change the content description associated with this menu item.                                                                                                                                                                                                                                                                        |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | [setIconTintList](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setIconTintList(android.view.MenuItem,android.content.res.ColorStateList))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`, tint: `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?)` Applies a tint to the item's icon.                                                                                                                                                                                                                                                                                                               |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | [setIconTintMode](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setIconTintMode(android.view.MenuItem,android.graphics.PorterDuff.Mode))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`, tintMode: `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?)` Specifies the blending mode used to apply the tint specified by[setIconTintList](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setIconTintList(android.view.MenuItem,android.content.res.ColorStateList))to the item's icon.                                                                                 |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | [setNumericShortcut](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setNumericShortcut(android.view.MenuItem,char,int))`(` ` item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`,` ` numericChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)`,` ` numericModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Change the numeric shortcut and modifiers associated with this item.                                                                                                                                                                                                   |
| `java-static `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!`                     | ~~[setOnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setOnActionExpandListener(android.view.MenuItem,androidx.core.view.MenuItemCompat.OnActionExpandListener))~~`(` ` item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!,` ` listener: `[MenuItemCompat.OnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat.OnActionExpandListener)`!` `)` **This function is deprecated.** Use[setOnActionExpandListener](https://developer.android.com/reference/android/view/MenuItem.html#setOnActionExpandListener(android.view.MenuItem.OnActionExpandListener))directly. <br />          |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | [setShortcut](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setShortcut(android.view.MenuItem,char,char,int,int))`(` ` item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`,` ` numericChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)`,` ` alphaChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)`,` ` numericModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` alphaModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Change both the numeric and alphabetic shortcut associated with this item. |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "item.setShowAsAction(actionEnum)")` ~~[setShowAsAction](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setShowAsAction(android.view.MenuItem,int))~~`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!, actionEnum: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.** Use[setShowAsAction](https://developer.android.com/reference/android/view/MenuItem.html#setShowAsAction(int))directly. <br />                                                                          |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                         | [setTooltipText](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setTooltipText(android.view.MenuItem,java.lang.CharSequence))`(item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`, tooltipText: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?)` Change the tooltip text associated with this menu item.                                                                                                                                                                                                                                                                                                    |

## Constants

### SHOW_AS_ACTION_ALWAYS

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
const val SHOW_AS_ACTION_ALWAYS = 2: Int
```
| **This property is deprecated.**   
|
| Use[SHOW_AS_ACTION_ALWAYS](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_ALWAYS())directly.

Always show this item as a button in an Action Bar. Use sparingly! If too many items are set to always show in the Action Bar it can crowd the Action Bar and degrade the user experience on devices with smaller screens. A good rule of thumb is to have no more than 2 items set to always show at a time.  

### SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
const val SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW = 8: Int
```
| **This property is deprecated.**   
|
| Use[SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW())directly.

This item's action view collapses to a normal menu item. When expanded, the action view temporarily takes over a larger segment of its container.  

### SHOW_AS_ACTION_IF_ROOM

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
const val SHOW_AS_ACTION_IF_ROOM = 1: Int
```
| **This property is deprecated.**   
|
| Use[SHOW_AS_ACTION_IF_ROOM](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_IF_ROOM())directly.

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

### SHOW_AS_ACTION_NEVER

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
const val SHOW_AS_ACTION_NEVER = 0: Int
```
| **This property is deprecated.**   
|
| Use[SHOW_AS_ACTION_NEVER](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_NEVER())directly.

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

### SHOW_AS_ACTION_WITH_TEXT

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
const val SHOW_AS_ACTION_WITH_TEXT = 4: Int
```
| **This property is deprecated.**   
|
| Use[SHOW_AS_ACTION_WITH_TEXT](https://developer.android.com/reference/android/view/MenuItem.html#SHOW_AS_ACTION_WITH_TEXT())directly.

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

## Public functions

### collapseActionView

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "item.collapseActionView()")
java-static fun [collapseActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#collapseActionView(android.view.MenuItem))(item: MenuItem!): Boolean
```
| **This function is deprecated.**   
|
| Use[collapseActionView](https://developer.android.com/reference/android/view/MenuItem.html#collapseActionView())directly.

Collapse the action view associated with this menu item. The menu item must have an action view set, as well as the showAsAction flag[SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW()). If a listener has been set using[setOnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setOnActionExpandListener(android.view.MenuItem,androidx.core.view.MenuItemCompat.OnActionExpandListener))it will have its[onMenuItemActionCollapse](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat.OnActionExpandListener#onMenuItemActionCollapse(android.view.MenuItem))method invoked. The listener may return false from this method to prevent collapsing the action view.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the action view was collapsed, false otherwise. |

### expandActionView

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "item.expandActionView()")
java-static fun [expandActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#expandActionView(android.view.MenuItem))(item: MenuItem!): Boolean
```
| **This function is deprecated.**   
|
| Use[expandActionView](https://developer.android.com/reference/android/view/MenuItem.html#expandActionView())directly.

Expand the action view associated with this menu item. The menu item must have an action view set, as well as the showAsAction flag[SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW()). If a listener has been set using[setOnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setOnActionExpandListener(android.view.MenuItem,androidx.core.view.MenuItemCompat.OnActionExpandListener))it will have its[onMenuItemActionExpand](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat.OnActionExpandListener#onMenuItemActionExpand(android.view.MenuItem))method invoked. The listener may return false from this method to prevent expanding the action view.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|--------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the action view was expanded, false otherwise. |

### getActionProvider

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getActionProvider(item: MenuItem): ActionProvider?
```

Gets the[ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider).  

|                                                Returns                                                |
|-------------------------------------------------------------------------------------------------------|----------------------|
| [ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider)`?` | The action provider. |

|                                                                                     See also                                                                                     |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider)                                                                               |   |
| [setActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionProvider(android.view.MenuItem,androidx.core.view.ActionProvider)) |   |

### getActionView

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "item.getActionView()")
java-static fun [getActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getActionView(android.view.MenuItem))(item: MenuItem!): View!
```
| **This function is deprecated.**   
|
| Use[getActionView](https://developer.android.com/reference/android/view/MenuItem.html#getActionView())directly.

Returns the currently set action view for this menu item.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|-------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!` | the item to query |

|                                  Returns                                  |
|---------------------------------------------------------------------------|-------------------------|
| [View](https://developer.android.com/reference/android/view/View.html)`!` | This item's action view |

### getAlphabeticModifiers

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getAlphabeticModifiers(item: MenuItem): Int
```

Return the modifier for this menu item's alphabetic shortcut. The modifier is a combination of[META_META_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_META_ON()),[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON()),[META_ALT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_ALT_ON()),[META_SHIFT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SHIFT_ON()),[META_SYM_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SYM_ON()),[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON()). For example,[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON())\|[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON())  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|-------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Modifier associated with the keyboard shortcut. |

### getContentDescription

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getContentDescription(item: MenuItem): CharSequence?
```

Retrieve the content description associated with this menu item.  

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|--------------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | The content description. |

### getIconTintList

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getIconTintList(item: MenuItem): ColorStateList?
```  

|                                               Returns                                                |
|------------------------------------------------------------------------------------------------------|-------------------------------------|
| [ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?` | the tint applied to the item's icon |

|                                                                                   See also                                                                                    |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setIconTintList](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setIconTintList(android.view.MenuItem,android.content.res.ColorStateList)) |   |

### getIconTintMode

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getIconTintMode(item: MenuItem): PorterDuff.Mode?
```

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

|                                               Returns                                               |
|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?` | the blending mode used to apply the tint to the item's icon |

|                                                                                  See also                                                                                   |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setIconTintMode](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setIconTintMode(android.view.MenuItem,android.graphics.PorterDuff.Mode)) |   |

### getNumericModifiers

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getNumericModifiers(item: MenuItem): Int
```

Return the modifiers for this menu item's numeric (12-key) shortcut. The modifier is a combination of[META_META_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_META_ON()),[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON()),[META_ALT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_ALT_ON()),[META_SHIFT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SHIFT_ON()),[META_SYM_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SYM_ON()),[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON()). For example,[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON())\|[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON())  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Modifier associated with the numeric shortcut. |

### getTooltipText

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getTooltipText(item: MenuItem): CharSequence?
```

Retrieve the tooltip text associated with this menu item.  

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|-------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | The tooltip text. |

### isActionViewExpanded

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "item.isActionViewExpanded()")
java-static fun [isActionViewExpanded](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#isActionViewExpanded(android.view.MenuItem))(item: MenuItem!): Boolean
```
| **This function is deprecated.**   
|
| Use[isActionViewExpanded](https://developer.android.com/reference/android/view/MenuItem.html#isActionViewExpanded())directly.

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

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|--------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the item's action view is expanded, false otherwise. |

|                                                                           See also                                                                            |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [expandActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#expandActionView(android.view.MenuItem))                  |   |
| [collapseActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#collapseActionView(android.view.MenuItem))              |   |
| [SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW()) |   |
| [MenuItemCompat.OnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat.OnActionExpandListener)              |   |

### setActionProvider

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setActionProvider(item: MenuItem, provider: ActionProvider?): MenuItem?
```

Sets the[ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider)responsible for creating an action view if the item is placed on the action bar. The provider also provides a default action invoked if the item is placed in the overflow menu.

**Note:** Setting an action provider overrides the action view set via[setActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionView(android.view.MenuItem,android.view.View)).  

|                                                    Parameters                                                     |
|-------------------------------------------------------------------------------------------------------------------|----------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)                            | item to change       |
| `provider: `[ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider)`?` | The action provider. |

|                                      Returns                                      |
|-----------------------------------------------------------------------------------|------------------------------------------------|
| [MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`?` | This Item so additional setters can be called. |

|                                              See also                                              |
|----------------------------------------------------------------------------------------------------|---|
| [ActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ActionProvider) |   |

### setActionView

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "item.setActionView(resId)")
java-static fun [setActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionView(android.view.MenuItem,int))(item: MenuItem!, resId: Int): MenuItem!
```
| **This function is deprecated.**   
|
| Use[setActionView](https://developer.android.com/reference/android/view/MenuItem.html#setActionView(int))directly.

Set an action view for this menu item. An action view will be displayed in place of an automatically generated menu item element in the UI when this item is shown as an action within a parent.

**Note:** Setting an action view overrides the action provider set via[setActionProvider](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionProvider(android.view.MenuItem,androidx.core.view.ActionProvider)).  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!` | the item to change                                           |
| `resId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)      | Layout resource to use for presenting this item to the user. |

|                                      Returns                                      |
|-----------------------------------------------------------------------------------|------------------------------------------------|
| [MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!` | This Item so additional setters can be called. |

|                                                                    See also                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setShowAsAction](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setShowAsAction(android.view.MenuItem,int)) |   |

### setActionView

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "item.setActionView(view)")
java-static fun [setActionView](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setActionView(android.view.MenuItem,android.view.View))(item: MenuItem!, view: View!): MenuItem!
```
| **This function is deprecated.**   
|
| Use[setActionView](https://developer.android.com/reference/android/view/MenuItem.html#setActionView(android.view.View))directly.

Set an action view for this menu item. An action view will be displayed in place of an automatically generated menu item element in the UI when this item is shown as an action within a parent.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|---------------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!` | the item to change                                |
| `view: `[View](https://developer.android.com/reference/android/view/View.html)`!`         | View to use for presenting this item to the user. |

|                                      Returns                                      |
|-----------------------------------------------------------------------------------|------------------------------------------------|
| [MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!` | This Item so additional setters can be called. |

|                                                                    See also                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setShowAsAction](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setShowAsAction(android.view.MenuItem,int)) |   |

### setAlphabeticShortcut

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setAlphabeticShortcut(item: MenuItem, alphaChar: Char, alphaModifiers: Int): Unit
```

Change the alphabetic shortcut associated with this item. The shortcut will be triggered when the key that generates the given character is pressed along with the modifier keys. Case is not significant and shortcut characters will be displayed in lower case. Note that menu items with the characters '\\b' or '\\n' as shortcuts will get triggered by the Delete key or Carriage Return key, respectively.

See[Menu](https://developer.android.com/reference/android/view/Menu.html)for the menu types that support shortcuts.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)        | item for which to set the shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `alphaChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)    | The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `alphaModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The modifier associated with the shortcut. It should be a combination of[META_META_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_META_ON()),[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON()),[META_ALT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_ALT_ON()),[META_SHIFT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SHIFT_ON()),[META_SYM_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SYM_ON()),[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON()). |

### setContentDescription

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setContentDescription(item: MenuItem, contentDescription: CharSequence?): Unit
```

Change the content description associated with this menu item.  

|                                                       Parameters                                                        |
|-------------------------------------------------------------------------------------------------------------------------|------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)                                  | item to change.              |
| `contentDescription: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | The new content description. |

### setIconTintList

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setIconTintList(item: MenuItem, tint: ColorStateList?): Unit
```

Applies a tint to the item's icon. Does not modify the current tint mode of that item, which is[SRC_IN](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html#SRC_IN)by default.

Subsequent calls to[setIcon](https://developer.android.com/reference/android/view/MenuItem.html#setIcon(android.graphics.drawable.Drawable))or[setIcon](https://developer.android.com/reference/android/view/MenuItem.html#setIcon(int))will automatically mutate the icon and apply the specified tint and tint mode.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|----------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)                       | item for which to set the tint.              |
| `tint: `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?` | the tint to apply, may be`null`to clear tint |

|                                                                  See also                                                                  |
|--------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getIconTintList](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#getIconTintList(android.view.MenuItem)) |   |

### setIconTintMode

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setIconTintMode(item: MenuItem, tintMode: PorterDuff.Mode?): Unit
```

Specifies the blending mode used to apply the tint specified by[setIconTintList](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setIconTintList(android.view.MenuItem,android.content.res.ColorStateList))to the item's icon. The default mode is[SRC_IN](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html#SRC_IN).  

|                                                   Parameters                                                    |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)                          | item for which to set the tint mode.                                |
| `tintMode: `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?` | the blending mode used to apply the tint, may be`null`to clear tint |

|                                                                                   See also                                                                                    |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setIconTintList](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setIconTintList(android.view.MenuItem,android.content.res.ColorStateList)) |   |

### setNumericShortcut

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setNumericShortcut(
    item: MenuItem,
    numericChar: Char,
    numericModifiers: Int
): Unit
```

Change the numeric shortcut and modifiers associated with this item.

See[Menu](https://developer.android.com/reference/android/view/Menu.html)for the menu types that support shortcuts.  

|                                           Parameters                                            |
|-------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)          | item for which to set the shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `numericChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)    | The numeric shortcut key. This is the shortcut when using a 12-key (numeric) keyboard.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `numericModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The modifier associated with the shortcut. It should be a combination of[META_META_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_META_ON()),[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON()),[META_ALT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_ALT_ON()),[META_SHIFT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SHIFT_ON()),[META_SYM_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SYM_ON()),[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON()). |

### setOnActionExpandListener

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun [setOnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setOnActionExpandListener(android.view.MenuItem,androidx.core.view.MenuItemCompat.OnActionExpandListener))(
    item: MenuItem!,
    listener: MenuItemCompat.OnActionExpandListener!
): MenuItem!
```
| **This function is deprecated.**   
|
| Use[setOnActionExpandListener](https://developer.android.com/reference/android/view/MenuItem.html#setOnActionExpandListener(android.view.MenuItem.OnActionExpandListener))directly.

Set an[OnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat.OnActionExpandListener)on this menu item to be notified when the associated action view is expanded or collapsed. The menu item must be configured to expand or collapse its action view using the flag[SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW()).  

|                                                                           Parameters                                                                            |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!`                                                                       | item on which to set the listener.                   |
| `listener: `[MenuItemCompat.OnActionExpandListener](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat.OnActionExpandListener)`!` | Listener that will respond to expand/collapse events |

|                                      Returns                                      |
|-----------------------------------------------------------------------------------|-------------------------------------------|
| [MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!` | This menu item instance for call chaining |

### setShortcut

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setShortcut(
    item: MenuItem,
    numericChar: Char,
    alphaChar: Char,
    numericModifiers: Int,
    alphaModifiers: Int
): Unit
```

Change both the numeric and alphabetic shortcut associated with this item. Note that the shortcut will be triggered when the key that generates the given character is pressed along with the corresponding modifier key. Also note that case is not significant and that alphabetic shortcut characters will be handled in lower case.

See[Menu](https://developer.android.com/reference/android/view/Menu.html)for the menu types that support shortcuts.  

|                                           Parameters                                            |
|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)          | item for which to set the shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `numericChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)    | The numeric shortcut key. This is the shortcut when using a numeric (e.g., 12-key) keyboard.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `alphaChar: `[Char](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char/index.html)      | The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `numericModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The numeric modifier associated with the shortcut. It should be a combination of[META_META_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_META_ON()),[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON()),[META_ALT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_ALT_ON()),[META_SHIFT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SHIFT_ON()),[META_SYM_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SYM_ON()),[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON()).    |
| `alphaModifiers: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)   | The alphabetic modifier associated with the shortcut. It should be a combination of[META_META_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_META_ON()),[META_CTRL_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_CTRL_ON()),[META_ALT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_ALT_ON()),[META_SHIFT_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SHIFT_ON()),[META_SYM_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_SYM_ON()),[META_FUNCTION_ON](https://developer.android.com/reference/android/view/KeyEvent.html#META_FUNCTION_ON()). |

### setShowAsAction

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "item.setShowAsAction(actionEnum)")
java-static fun [setShowAsAction](https://developer.android.com/reference/kotlin/androidx/core/view/MenuItemCompat#setShowAsAction(android.view.MenuItem,int))(item: MenuItem!, actionEnum: Int): Unit
```
| **This function is deprecated.**   
|
| Use[setShowAsAction](https://developer.android.com/reference/android/view/MenuItem.html#setShowAsAction(int))directly.

Sets how this item should display in the presence of a compatible Action Bar. If the given item is compatible, this will call the item's supported implementation of[setShowAsAction](https://developer.android.com/reference/android/view/MenuItem.html#setShowAsAction(int)).  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|--------------------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)`!` | - the item to change           |
| `actionEnum: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | - How the item should display. |

### setTooltipText

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setTooltipText(item: MenuItem, tooltipText: CharSequence?): Unit
```

Change the tooltip text associated with this menu item.  

|                                                    Parameters                                                    |
|------------------------------------------------------------------------------------------------------------------|----------------------|
| `item: `[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)                           | item to change.      |
| `tooltipText: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | The new tooltip text |