# MenuCompat

# MenuCompat

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/MenuCompat.java+class:androidx.core.view.MenuCompat)  
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/MenuCompat "View this page in Java")

<br />

```
class MenuCompat
```

<br />

*** ** * ** ***

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

## Summary

|                                    ### Public functions                                     |
|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setGroupDividerEnabled](https://developer.android.com/reference/kotlin/androidx/core/view/MenuCompat#setGroupDividerEnabled(android.view.Menu,boolean))`(menu: `[Menu](https://developer.android.com/reference/android/view/Menu.html)`, enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Enable or disable the group dividers.                                                                                                                                                                                                                                                                        |
| `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/MenuCompat#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 /> |

## Public functions

### setGroupDividerEnabled

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

```
java-static fun setGroupDividerEnabled(menu: Menu, enabled: Boolean): Unit
```

Enable or disable the group dividers.  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|-------------------------------------|
| `menu: `[Menu](https://developer.android.com/reference/android/view/Menu.html)                 | Menu to enable/disable dividers on. |
| `enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if enabled                     |

### 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/MenuCompat#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.

Call[MenuItem.setShowAsAction()](https://developer.android.com/reference/android/view/MenuItem.html#setShowAsAction(int)).