Methods Summary |
---|
public boolean | collapseActionView()Collapse the action view associated with this menu item. The menu item must have an action
view set, as well as the showAsAction flag {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}. If a
listener has been set using {@link #setSupportOnActionExpandListener(android.support.v4.view.MenuItemCompat.OnActionExpandListener)}
it will have its {@link android.support.v4.view.MenuItemCompat.OnActionExpandListener#onMenuItemActionCollapse(MenuItem)} method
invoked. The listener may return false from this method to prevent collapsing the action
view.
|
public boolean | expandActionView()Expand the action view associated with this menu item. The menu item must have an action view
set, as well as the showAsAction flag {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}. If a
listener has been set using {@link #setSupportOnActionExpandListener(android.support.v4.view.MenuItemCompat.OnActionExpandListener)}
it will have its {@link android.support.v4.view.MenuItemCompat.OnActionExpandListener#onMenuItemActionExpand(MenuItem)} method
invoked. The listener may return false from this method to prevent expanding the action view.
|
public android.view.View | getActionView()Returns the currently set action view for this menu item.
|
public android.support.v4.view.ActionProvider | getSupportActionProvider()Gets the {@link ActionProvider}.
|
public boolean | isActionViewExpanded()Returns true if this menu item's action view has been expanded.
|
public android.view.MenuItem | setActionView(android.view.View view)Set an action view for this menu item. An action view will be displayed in place
of an automatically generated menu item element in the UI when this item is shown
as an action within a parent.
Note: Setting an action view overrides the action provider
provider set via {@link #setSupportActionProvider(android.support.v4.view.ActionProvider)}.
|
public android.view.MenuItem | setActionView(int resId)Set an action view for this menu item. An action view will be displayed in place
of an automatically generated menu item element in the UI when this item is shown
as an action within a parent.
Note: Setting an action view overrides the action provider
provider set via {@link #setSupportActionProvider(android.support.v4.view.ActionProvider)}.
|
public void | setShowAsAction(int actionEnum)Sets how this item should display in the presence of an Action Bar. The parameter actionEnum
is a flag set. One of {@link #SHOW_AS_ACTION_ALWAYS}, {@link #SHOW_AS_ACTION_IF_ROOM}, or
{@link #SHOW_AS_ACTION_NEVER} should be used, and you may optionally OR the value with {@link
#SHOW_AS_ACTION_WITH_TEXT}. SHOW_AS_ACTION_WITH_TEXT requests that when the item is shown as
an action, it should be shown with a text label.
|
public android.view.MenuItem | setShowAsActionFlags(int actionEnum)Sets how this item should display in the presence of an Action Bar.
The parameter actionEnum is a flag set. One of {@link #SHOW_AS_ACTION_ALWAYS},
{@link #SHOW_AS_ACTION_IF_ROOM}, or {@link #SHOW_AS_ACTION_NEVER} should
be used, and you may optionally OR the value with {@link #SHOW_AS_ACTION_WITH_TEXT}.
SHOW_AS_ACTION_WITH_TEXT requests that when the item is shown as an action,
it should be shown with a text label.
Note: This method differs from {@link #setShowAsAction(int)} only in that it
returns the current MenuItem instance for call chaining.
|
public android.support.v4.internal.view.SupportMenuItem | setSupportActionProvider(android.support.v4.view.ActionProvider actionProvider)Sets the {@link android.support.v4.view.ActionProvider} responsible for creating an action view if
the item is placed on the action bar. The provider also provides a default
action invoked if the item is placed in the overflow menu.
Note: Setting an action provider overrides the action view
set via {@link #setActionView(int)} or {@link #setActionView(View)}.
|
public android.support.v4.internal.view.SupportMenuItem | setSupportOnActionExpandListener(MenuItemCompat.OnActionExpandListener listener)Set an {@link android.support.v4.view.MenuItemCompat.OnActionExpandListener} on this menu item to be notified when the associated
action view is expanded or collapsed. The menu item must be configured to expand or collapse
its action view using the flag {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}.
|