Stay organized with collections
Save and categorize content based on your preferences.
OnActionExpandListener
interface OnActionExpandListener
Interface definition for a callback to be invoked when a menu item marked with MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
is expanded or collapsed.
Summary
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MenuItem.OnActionExpandListener\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnActionExpandListener\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/MenuItem.OnActionExpandListener \"View this page in Java\") \n\n```\ninterface OnActionExpandListener\n```\n\n|---------------------------------------------------|\n| [android.view.MenuItem.OnActionExpandListener](#) |\n\nInterface definition for a callback to be invoked when a menu item marked with [MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/kotlin/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW:kotlin.Int) is expanded or collapsed.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onMenuItemActionCollapse](#onMenuItemActionCollapse(android.view.MenuItem))`(`item:` `[MenuItem](/reference/kotlin/android/view/MenuItem)`)` Called when a menu item with [MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/kotlin/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW:kotlin.Int) is collapsed. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onMenuItemActionExpand](#onMenuItemActionExpand(android.view.MenuItem))`(`item:` `[MenuItem](/reference/kotlin/android/view/MenuItem)`)` Called when a menu item with [MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/kotlin/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW:kotlin.Int) is expanded. |\n\nPublic methods\n--------------\n\n### onMenuItemActionCollapse\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onMenuItemActionCollapse(item: MenuItem): Boolean\n```\n\nCalled when a menu item with [MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/kotlin/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW:kotlin.Int) is collapsed.\n\n| Parameters ||\n|--------|-----------------------------------------------------------------------------------------------------------|\n| `item` | [MenuItem](/reference/kotlin/android/view/MenuItem): Item that was collapsed This value cannot be `null`. |\n\n| Return ||\n|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the item should collapse, false if collapsing should be suppressed. |\n\n### onMenuItemActionExpand\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onMenuItemActionExpand(item: MenuItem): Boolean\n```\n\nCalled when a menu item with [MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/kotlin/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW:kotlin.Int) is expanded.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------|\n| `item` | [MenuItem](/reference/kotlin/android/view/MenuItem): Item that was expanded This value cannot be `null`. |\n\n| Return ||\n|------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the item should expand, false if expansion should be suppressed. |"]]