public class ActionMenuView
extends java.lang.Object
Constructor and Description |
---|
ActionMenuView(android.content.Context context,
android.view.View parent)
General constructor
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
alwaysShowActionMenu()
Determines if the action menu is shown always or only after user
interaction.
|
void |
closeActionMenu(boolean animate)
Programmatically closes the action menu.
|
boolean |
dispatchKeyEvent(android.view.KeyEvent event) |
protected int |
getActionMenuGravity()
Determines the gravity of the action menu.
|
android.content.Context |
getContext() |
protected int |
getDefaultAction()
Determines the default action item that will be selected when the action
menu displays.
|
protected int |
getDefaultActionId()
Allows subclasses to specify the default item in the menu based on id.
|
protected int |
getMenuItemIndex(android.view.MenuItem item,
boolean visibleOnly)
Retrieve the index in the menu for a specific MenuItem
|
protected void |
invalidateActionMenu()
Declare that the action menu has changed, so should be recreated.
|
protected void |
onActionItemFocused(android.view.MenuItem item)
This hook is called whenever the focused item in your action menu changes.
|
protected boolean |
onActionItemSelected(android.view.MenuItem item)
This hook is called whenever an item in your action menu is selected.
|
boolean |
onActionMenuItemSelected(android.view.MenuItem item) |
protected boolean |
onCreateActionMenu(android.view.Menu menu)
Initialize the contents of the Activity's action menu.
|
protected boolean |
onPrepareActionMenu(android.view.Menu menu)
Prepare the Screen's action menu to be displayed.
|
void |
openActionMenu()
Programmatically opens the action menu.
|
void |
openActionMenu(boolean animate)
Programmatically opens the action menu.
|
protected void |
setCurrentMenuIndex(int index,
boolean animate)
Programmatically set a specific index to be the currently selected
item.
|
protected void |
setCurrentMenuItem(android.view.MenuItem item,
boolean animate)
Programmatically set a specific MenuItem to be the currently selected
item.
|
public ActionMenuView(android.content.Context context, android.view.View parent)
context
- Contextparent
- View to which the ActionMenu will attach itselfpublic final boolean onActionMenuItemSelected(android.view.MenuItem item)
public void openActionMenu()
public void openActionMenu(boolean animate)
animate
- true to animate the menu, false to show it without animationprotected void onActionItemFocused(android.view.MenuItem item)
item
- The menu item that has focus.protected boolean onActionItemSelected(android.view.MenuItem item)
Derived classes should call through to the base class for it to perform the default menu handling.
item
- The menu item that was selected.onCreateActionMenu(android.view.Menu)
protected void invalidateActionMenu()
onCreateActionMenu(Menu)
method will be called the next
time it needs to be displayed. If the action menu is currently being
displayed, the menu will be rebuilt immediately.protected boolean onCreateActionMenu(android.view.Menu menu)
This is only called once, the first time the action menu is
displayed. To update the menu every time it is displayed, see
onPrepareActionMenu(android.view.Menu)
.
The default implementation populates the menu with a back menu item. Deriving classes should always call through to the base implementation.
You can safely hold on to menu (and any items created from it), making modifications to it as desired, until the next time onCreateOptionsMenu() is called.
When you add items to the menu, you can implement the Activity's
onActionItemSelected(android.view.MenuItem)
method to handle them there.
menu
- The action menu in which you place your items.onPrepareActionMenu(android.view.Menu)
,
onActionItemSelected(android.view.MenuItem)
protected boolean onPrepareActionMenu(android.view.Menu menu)
menu
- The options menu as last shown or first initialized by
onCreateActionMenu().onCreateActionMenu(android.view.Menu)
protected int getDefaultAction()
protected int getDefaultActionId()
protected boolean alwaysShowActionMenu()
protected int getActionMenuGravity()
protected void setCurrentMenuItem(android.view.MenuItem item, boolean animate)
item
- The MenuItem to selectanimate
- whether or not to animate the selection changeprotected void setCurrentMenuIndex(int index, boolean animate)
index
- The index of a MenuItem to selectanimate
- whether or not to animate the selection changeprotected int getMenuItemIndex(android.view.MenuItem item, boolean visibleOnly)
item
- The MenuItem to look forvisibleOnly
- if true, only the currently visible menu items
will be searchedpublic void closeActionMenu(boolean animate)
animate
- true to animate the menu, false to show it without animationpublic android.content.Context getContext()
public boolean dispatchKeyEvent(android.view.KeyEvent event)