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,["# MenuItemCompat.OnActionExpandListener\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1 \nDeprecated since version 26.1.0 \n\nMenuItemCompat.OnActionExpandListener\n=====================================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\nstatic\n\n\ninterface\nMenuItemCompat.OnActionExpandListener\n`\n\n\n`\n\n\n`\n\n|---------------------------------------------------------------|\n| android.support.v4.view.MenuItemCompat.OnActionExpandListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\n**This interface was deprecated\nin API level 26.1.0.** \n\nUse [MenuItem.OnActionExpandListener](https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener.html) directly.\n\nInterface definition for a callback to be invoked when a menu item marked with [SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/android/support/v4/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) is expanded or collapsed. \n**See also:**\n\n- [expandActionView(android.view.MenuItem)](/reference/android/support/v4/view/MenuItemCompat#expandActionView(android.view.MenuItem))\n- [collapseActionView(android.view.MenuItem)](/reference/android/support/v4/view/MenuItemCompat#collapseActionView(android.view.MenuItem))\n- [setShowAsAction(android.view.MenuItem, int)](/reference/android/support/v4/view/MenuItemCompat#setShowAsAction(android.view.MenuItem, int))\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onMenuItemActionCollapse](/reference/android/support/v4/view/MenuItemCompat.OnActionExpandListener#onMenuItemActionCollapse(android.view.MenuItem))`(`[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)` item) ` Called when a menu item with [SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/android/support/v4/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) is collapsed. |\n| ` abstract boolean` | ` `[onMenuItemActionExpand](/reference/android/support/v4/view/MenuItemCompat.OnActionExpandListener#onMenuItemActionExpand(android.view.MenuItem))`(`[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)` item) ` Called when a menu item with [SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/android/support/v4/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) is expanded. |\n\nPublic methods\n--------------\n\n### onMenuItemActionCollapse\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nboolean onMenuItemActionCollapse (MenuItem item)\n```\n\nCalled when a menu item with [SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/android/support/v4/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW)\nis collapsed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|--------------------------------------------|\n| `item` | `MenuItem`: Item that was collapsed \u003cbr /\u003e |\n\n| Returns ||\n|-----------|------------------------------------------------------------------------------------|\n| `boolean` | true if the item should collapse, false if collapsing should be suppressed. \u003cbr /\u003e |\n\n### onMenuItemActionExpand\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nboolean onMenuItemActionExpand (MenuItem item)\n```\n\nCalled when a menu item with [SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW](/reference/android/support/v4/view/MenuItemCompat#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW)\nis expanded.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|-------------------------------------------|\n| `item` | `MenuItem`: Item that was expanded \u003cbr /\u003e |\n\n| Returns ||\n|-----------|---------------------------------------------------------------------------------|\n| `boolean` | true if the item should expand, false if expansion should be suppressed. \u003cbr /\u003e |\n\n-\n\n Annotations\n -----------\n\n - [ViewPager.DecorView](/reference/android/support/v4/view/ViewPager.DecorView)\n-\n\n Interfaces\n ----------\n\n - [ActionProvider.VisibilityListener](/reference/android/support/v4/view/ActionProvider.VisibilityListener)\n - [AsyncLayoutInflater.OnInflateFinishedListener](/reference/android/support/v4/view/AsyncLayoutInflater.OnInflateFinishedListener)\n - [LayoutInflaterFactory](/reference/android/support/v4/view/LayoutInflaterFactory)\n - [MenuItemCompat.OnActionExpandListener](/reference/android/support/v4/view/MenuItemCompat.OnActionExpandListener)\n - [NestedScrollingChild](/reference/android/support/v4/view/NestedScrollingChild)\n - [NestedScrollingChild2](/reference/android/support/v4/view/NestedScrollingChild2)\n - [NestedScrollingParent](/reference/android/support/v4/view/NestedScrollingParent)\n - [NestedScrollingParent2](/reference/android/support/v4/view/NestedScrollingParent2)\n - [OnApplyWindowInsetsListener](/reference/android/support/v4/view/OnApplyWindowInsetsListener)\n - [ScrollingView](/reference/android/support/v4/view/ScrollingView)\n - [TintableBackgroundView](/reference/android/support/v4/view/TintableBackgroundView)\n - [ViewPager.OnAdapterChangeListener](/reference/android/support/v4/view/ViewPager.OnAdapterChangeListener)\n - [ViewPager.OnPageChangeListener](/reference/android/support/v4/view/ViewPager.OnPageChangeListener)\n - [ViewPager.PageTransformer](/reference/android/support/v4/view/ViewPager.PageTransformer)\n - [ViewPropertyAnimatorListener](/reference/android/support/v4/view/ViewPropertyAnimatorListener)\n - [ViewPropertyAnimatorUpdateListener](/reference/android/support/v4/view/ViewPropertyAnimatorUpdateListener)\n-\n\n Classes\n -------\n\n - [AbsSavedState](/reference/android/support/v4/view/AbsSavedState)\n - [AccessibilityDelegateCompat](/reference/android/support/v4/view/AccessibilityDelegateCompat)\n - [ActionProvider](/reference/android/support/v4/view/ActionProvider)\n - [AsyncLayoutInflater](/reference/android/support/v4/view/AsyncLayoutInflater)\n - [GestureDetectorCompat](/reference/android/support/v4/view/GestureDetectorCompat)\n - [GravityCompat](/reference/android/support/v4/view/GravityCompat)\n - [InputDeviceCompat](/reference/android/support/v4/view/InputDeviceCompat)\n - [LayoutInflaterCompat](/reference/android/support/v4/view/LayoutInflaterCompat)\n - [MarginLayoutParamsCompat](/reference/android/support/v4/view/MarginLayoutParamsCompat)\n - [MenuCompat](/reference/android/support/v4/view/MenuCompat)\n - [MenuItemCompat](/reference/android/support/v4/view/MenuItemCompat)\n - [MotionEventCompat](/reference/android/support/v4/view/MotionEventCompat)\n - [NestedScrollingChildHelper](/reference/android/support/v4/view/NestedScrollingChildHelper)\n - [NestedScrollingParentHelper](/reference/android/support/v4/view/NestedScrollingParentHelper)\n - [PagerAdapter](/reference/android/support/v4/view/PagerAdapter)\n - [PagerTabStrip](/reference/android/support/v4/view/PagerTabStrip)\n - [PagerTitleStrip](/reference/android/support/v4/view/PagerTitleStrip)\n - [PointerIconCompat](/reference/android/support/v4/view/PointerIconCompat)\n - [ScaleGestureDetectorCompat](/reference/android/support/v4/view/ScaleGestureDetectorCompat)\n - [VelocityTrackerCompat](/reference/android/support/v4/view/VelocityTrackerCompat)\n - [ViewCompat](/reference/android/support/v4/view/ViewCompat)\n - [ViewConfigurationCompat](/reference/android/support/v4/view/ViewConfigurationCompat)\n - [ViewGroupCompat](/reference/android/support/v4/view/ViewGroupCompat)\n - [ViewPager](/reference/android/support/v4/view/ViewPager)\n - [ViewPager.LayoutParams](/reference/android/support/v4/view/ViewPager.LayoutParams)\n - [ViewPager.SavedState](/reference/android/support/v4/view/ViewPager.SavedState)\n - [ViewPager.SimpleOnPageChangeListener](/reference/android/support/v4/view/ViewPager.SimpleOnPageChangeListener)\n - [ViewParentCompat](/reference/android/support/v4/view/ViewParentCompat)\n - [ViewPropertyAnimatorCompat](/reference/android/support/v4/view/ViewPropertyAnimatorCompat)\n - [ViewPropertyAnimatorListenerAdapter](/reference/android/support/v4/view/ViewPropertyAnimatorListenerAdapter)\n - [WindowCompat](/reference/android/support/v4/view/WindowCompat)\n - [WindowInsetsCompat](/reference/android/support/v4/view/WindowInsetsCompat)"]]