Skip to content

Most visited

Recently visited

navigation
added in version 25.1.0
belongs to Maven artifact com.android.support:appcompat-v7:27.0.0

ActionMenuView

public class ActionMenuView
extends LinearLayoutCompat

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.v7.widget.LinearLayoutCompat
         ↳ android.support.v7.widget.ActionMenuView


ActionMenuView is a presentation of a series of menu options as a View. It provides several top level options as action buttons while spilling remaining options over as items in an overflow menu. This allows applications to present packs of actions inline with specific or repeating content.

Summary

Nested classes

class ActionMenuView.LayoutParams

 

interface ActionMenuView.OnMenuItemClickListener

Interface responsible for receiving menu item click events if the items themselves do not have individual item click listeners. 

Inherited constants

From class android.support.v7.widget.LinearLayoutCompat
From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

ActionMenuView(Context context)
ActionMenuView(Context context, AttributeSet attrs)

Public methods

void dismissPopupMenus()

Dismiss any popups associated with this menu view.

boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event)
ActionMenuView.LayoutParams generateLayoutParams(AttributeSet attrs)
Menu getMenu()

Returns the Menu object that this ActionMenuView is currently presenting.

Drawable getOverflowIcon()

Return the current drawable used as the overflow icon.

int getPopupTheme()
boolean hideOverflowMenu()

Hide the overflow items from the associated menu.

boolean isOverflowMenuShowing()

Check whether the overflow menu is currently showing.

void onConfigurationChanged(Configuration newConfig)
void onDetachedFromWindow()
void setOnMenuItemClickListener(ActionMenuView.OnMenuItemClickListener listener)
void setOverflowIcon(Drawable icon)

Set the icon to use for the overflow button.

void setPopupTheme(int resId)

Specifies the theme to use when inflating popup menus.

boolean showOverflowMenu()

Show the overflow items from the associated menu.

Protected methods

boolean checkLayoutParams(ViewGroup.LayoutParams p)
ActionMenuView.LayoutParams generateDefaultLayoutParams()

Returns a set of layout parameters with a width of MATCH_PARENT and a height of WRAP_CONTENT when the layout's orientation is VERTICAL.

ActionMenuView.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
void onLayout(boolean changed, int left, int top, int right, int bottom)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Inherited methods

From class android.support.v7.widget.LinearLayoutCompat
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

ActionMenuView

added in version 25.1.0
ActionMenuView (Context context)

Parameters
context Context

ActionMenuView

added in version 25.1.0
ActionMenuView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Public methods

dismissPopupMenus

added in version 25.1.0
void dismissPopupMenus ()

Dismiss any popups associated with this menu view.

dispatchPopulateAccessibilityEvent

boolean dispatchPopulateAccessibilityEvent (AccessibilityEvent event)

Parameters
event AccessibilityEvent

Returns
boolean

generateLayoutParams

added in version 26.1.0
ActionMenuView.LayoutParams generateLayoutParams (AttributeSet attrs)

Parameters
attrs AttributeSet

Returns
ActionMenuView.LayoutParams

getMenu

added in version 25.1.0
Menu getMenu ()

Returns the Menu object that this ActionMenuView is currently presenting.

Applications should use this method to obtain the ActionMenuView's Menu object and inflate or add content to it as necessary.

Returns
Menu the Menu presented by this view

getOverflowIcon

added in version 25.1.0
Drawable getOverflowIcon ()

Return the current drawable used as the overflow icon.

Returns
Drawable The overflow icon drawable

getPopupTheme

added in version 25.1.0
int getPopupTheme ()

Returns
int resource identifier of the theme used to inflate popup menus, or 0 if menus are inflated against the action menu view theme

See also:

hideOverflowMenu

added in version 25.1.0
boolean hideOverflowMenu ()

Hide the overflow items from the associated menu.

Returns
boolean true if the menu was able to be hidden, false otherwise

isOverflowMenuShowing

added in version 25.1.0
boolean isOverflowMenuShowing ()

Check whether the overflow menu is currently showing. This may not reflect a pending show operation in progress.

Returns
boolean true if the overflow menu is currently showing

onConfigurationChanged

added in version 25.1.0
void onConfigurationChanged (Configuration newConfig)

Parameters
newConfig Configuration

onDetachedFromWindow

added in version 25.1.0
void onDetachedFromWindow ()

setOnMenuItemClickListener

added in version 25.1.0
void setOnMenuItemClickListener (ActionMenuView.OnMenuItemClickListener listener)

Parameters
listener ActionMenuView.OnMenuItemClickListener

setOverflowIcon

added in version 25.1.0
void setOverflowIcon (Drawable icon)

Set the icon to use for the overflow button.

Parameters
icon Drawable: Drawable to set, may be null to clear the icon

setPopupTheme

added in version 25.1.0
void setPopupTheme (int resId)

Specifies the theme to use when inflating popup menus. By default, uses the same theme as the action menu view itself.

Parameters
resId int: theme used to inflate popup menus

See also:

showOverflowMenu

added in version 25.1.0
boolean showOverflowMenu ()

Show the overflow items from the associated menu.

Returns
boolean true if the menu was able to be shown, false otherwise

Protected methods

checkLayoutParams

boolean checkLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams

Returns
boolean

generateDefaultLayoutParams

added in version 26.1.0
ActionMenuView.LayoutParams generateDefaultLayoutParams ()

Returns a set of layout parameters with a width of MATCH_PARENT and a height of WRAP_CONTENT when the layout's orientation is VERTICAL. When the orientation is HORIZONTAL, the width is set to WRAP_CONTENT and the height to WRAP_CONTENT.

Returns
ActionMenuView.LayoutParams

generateLayoutParams

added in version 26.1.0
ActionMenuView.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams

Returns
ActionMenuView.LayoutParams

onLayout

added in version 25.1.0
void onLayout (boolean changed, 
                int left, 
                int top, 
                int right, 
                int bottom)

Parameters
changed boolean

left int

top int

right int

bottom int

onMeasure

void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)