added in version 1.0.0
belongs to Maven artifact androidx.appcompat:appcompat:1.0.0-beta01

ActionMenuView

public class ActionMenuView
extends LinearLayoutCompat

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.appcompat.widget.LinearLayoutCompat
         ↳ androidx.appcompat.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

Inherited fields

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 ViewGroup.LayoutParams.MATCH_PARENT and a height of ViewGroup.LayoutParams.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

Public constructors

ActionMenuView

added in version 1.0.0
public ActionMenuView (Context context)

Parameters
context Context

ActionMenuView

added in version 1.0.0
public ActionMenuView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Public methods

dismissPopupMenus

added in version 1.0.0
public void dismissPopupMenus ()

Dismiss any popups associated with this menu view.

dispatchPopulateAccessibilityEvent

public boolean dispatchPopulateAccessibilityEvent (AccessibilityEvent event)

Parameters
event AccessibilityEvent

Returns
boolean

generateLayoutParams

added in version 1.0.0
public ActionMenuView.LayoutParams generateLayoutParams (AttributeSet attrs)

Parameters
attrs AttributeSet

Returns
ActionMenuView.LayoutParams

getMenu

added in version 1.0.0
public 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 1.0.0
public Drawable getOverflowIcon ()

Return the current drawable used as the overflow icon.

Returns
Drawable The overflow icon drawable

getPopupTheme

added in version 1.0.0
public 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 1.0.0
public 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 1.0.0
public 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 1.0.0
public void onConfigurationChanged (Configuration newConfig)

Parameters
newConfig Configuration

onDetachedFromWindow

added in version 1.0.0
public void onDetachedFromWindow ()

setOnMenuItemClickListener

added in version 1.0.0
public void setOnMenuItemClickListener (ActionMenuView.OnMenuItemClickListener listener)

Parameters
listener ActionMenuView.OnMenuItemClickListener

setOverflowIcon

added in version 1.0.0
public 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 1.0.0
public 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 1.0.0
public 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

protected boolean checkLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams

Returns
boolean

generateDefaultLayoutParams

added in version 1.0.0
protected ActionMenuView.LayoutParams generateDefaultLayoutParams ()

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

Returns
ActionMenuView.LayoutParams

generateLayoutParams

added in version 1.0.0
protected ActionMenuView.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams

Returns
ActionMenuView.LayoutParams

onLayout

protected void onLayout (boolean changed, 
                int left, 
                int top, 
                int right, 
                int bottom)

Parameters
changed boolean

left int

top int

right int

bottom int

onMeasure

protected void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int