|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SupportMenuItem
Interface for direct access to a previously created menu item. This version extends the one available in the framework to ensures that any necessary elements added in later versions of the framework, are available for all platforms.
MenuItem
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface android.view.MenuItem |
---|
android.view.MenuItem.OnMenuItemClickListener |
Field Summary | |
---|---|
static int |
SHOW_AS_ACTION_ALWAYS
Always show this item as a button in an Action Bar. |
static int |
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
This item's action view collapses to a normal menu item. |
static int |
SHOW_AS_ACTION_IF_ROOM
Show this item as a button in an Action Bar if the system decides there is room for it. |
static int |
SHOW_AS_ACTION_NEVER
Never show this item as a button in an Action Bar. |
static int |
SHOW_AS_ACTION_WITH_TEXT
When this item is in the action bar, always show it with a text label even if it also has an icon specified. |
Method Summary | |
---|---|
boolean |
collapseActionView()
Collapse the action view associated with this menu item. |
boolean |
expandActionView()
Expand the action view associated with this menu item. |
android.view.View |
getActionView()
Returns the currently set action view for this menu item. |
ActionProvider |
getSupportActionProvider()
Gets the ActionProvider . |
boolean |
isActionViewExpanded()
Returns true if this menu item's action view has been expanded. |
android.view.MenuItem |
setActionView(int resId)
Set an action view for this menu item. |
android.view.MenuItem |
setActionView(android.view.View view)
Set an action view for this menu item. |
void |
setShowAsAction(int actionEnum)
Sets how this item should display in the presence of an Action Bar. |
android.view.MenuItem |
setShowAsActionFlags(int actionEnum)
Sets how this item should display in the presence of an Action Bar. |
SupportMenuItem |
setSupportActionProvider(ActionProvider actionProvider)
Sets the ActionProvider responsible for creating an action view if
the item is placed on the action bar. |
SupportMenuItem |
setSupportOnActionExpandListener(MenuItemCompat.OnActionExpandListener listener)
Set an MenuItemCompat.OnActionExpandListener on this menu item to be notified when the associated
action view is expanded or collapsed. |
Methods inherited from interface android.view.MenuItem |
---|
getAlphabeticShortcut, getGroupId, getIcon, getIntent, getItemId, getMenuInfo, getNumericShortcut, getOrder, getSubMenu, getTitle, getTitleCondensed, hasSubMenu, isCheckable, isChecked, isEnabled, isVisible, setAlphabeticShortcut, setCheckable, setChecked, setEnabled, setIcon, setIcon, setIntent, setNumericShortcut, setOnMenuItemClickListener, setShortcut, setTitle, setTitle, setTitleCondensed, setVisible |
Field Detail |
---|
static final int SHOW_AS_ACTION_NEVER
static final int SHOW_AS_ACTION_IF_ROOM
static final int SHOW_AS_ACTION_ALWAYS
static final int SHOW_AS_ACTION_WITH_TEXT
static final int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
Method Detail |
---|
void setShowAsAction(int actionEnum)
SHOW_AS_ACTION_ALWAYS
, SHOW_AS_ACTION_IF_ROOM
, or
SHOW_AS_ACTION_NEVER
should be used, and you may optionally OR the value with 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.
actionEnum
- How the item should display. One of SHOW_AS_ACTION_ALWAYS
, SHOW_AS_ACTION_IF_ROOM
, or SHOW_AS_ACTION_NEVER
.
SHOW_AS_ACTION_NEVER is the default.android.app.ActionBar
,
setActionView(View)
android.view.MenuItem setShowAsActionFlags(int actionEnum)
SHOW_AS_ACTION_ALWAYS
,
SHOW_AS_ACTION_IF_ROOM
, or SHOW_AS_ACTION_NEVER
should
be used, and you may optionally OR the value with 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 setShowAsAction(int)
only in that it
returns the current MenuItem instance for call chaining.
actionEnum
- How the item should display. One of SHOW_AS_ACTION_ALWAYS
, SHOW_AS_ACTION_IF_ROOM
, or SHOW_AS_ACTION_NEVER
.
SHOW_AS_ACTION_NEVER is the default.
android.app.ActionBar
,
setActionView(View)
android.view.MenuItem setActionView(android.view.View view)
Note: Setting an action view overrides the action provider
provider set via setSupportActionProvider(android.support.v4.view.ActionProvider)
.
view
- View to use for presenting this item to the user.
setShowAsAction(int)
android.view.MenuItem setActionView(int resId)
Note: Setting an action view overrides the action provider
provider set via setSupportActionProvider(android.support.v4.view.ActionProvider)
.
resId
- Layout resource to use for presenting this item to the user.
setShowAsAction(int)
android.view.View getActionView()
setActionView(View)
,
setShowAsAction(int)
SupportMenuItem setSupportActionProvider(ActionProvider actionProvider)
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 setActionView(int)
or setActionView(View)
.
actionProvider
- The action provider.
ActionProvider
ActionProvider getSupportActionProvider()
ActionProvider
.
ActionProvider
,
setSupportActionProvider(ActionProvider)
boolean expandActionView()
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
. If a
listener has been set using setSupportOnActionExpandListener(android.support.v4.view.MenuItemCompat.OnActionExpandListener)
it will have its MenuItemCompat.OnActionExpandListener.onMenuItemActionExpand(MenuItem)
method
invoked. The listener may return false from this method to prevent expanding the action view.
boolean collapseActionView()
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
. If a
listener has been set using setSupportOnActionExpandListener(android.support.v4.view.MenuItemCompat.OnActionExpandListener)
it will have its MenuItemCompat.OnActionExpandListener.onMenuItemActionCollapse(MenuItem)
method
invoked. The listener may return false from this method to prevent collapsing the action
view.
boolean isActionViewExpanded()
expandActionView()
,
collapseActionView()
,
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
,
MenuItemCompat.OnActionExpandListener
SupportMenuItem setSupportOnActionExpandListener(MenuItemCompat.OnActionExpandListener listener)
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 SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
.
listener
- Listener that will respond to expand/collapse events
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |