public interface ContextMenu extends Menu
Menu
for context menus providing functionality to modify
the header of the context menu.
Context menus do not support item shortcuts and item icons.
To show a context menu on long click, most clients will want to call
Activity.registerForContextMenu(android.view.View)
and override
Activity.onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)
.
For information about creating menus, read the Menus developer guide.
Modifier and Type | Interface and Description |
---|---|
static interface |
ContextMenu.ContextMenuInfo
Additional information regarding the creation of the context menu.
|
CATEGORY_ALTERNATIVE, CATEGORY_CONTAINER, CATEGORY_MASK, CATEGORY_SECONDARY, CATEGORY_SHIFT, CATEGORY_SYSTEM, FIRST, FLAG_ALWAYS_PERFORM_CLOSE, FLAG_APPEND_TO_GROUP, FLAG_PERFORM_NO_CLOSE, NONE, USER_MASK, USER_SHIFT
Modifier and Type | Method and Description |
---|---|
void |
clearHeader()
Clears the header of the context menu.
|
ContextMenu |
setHeaderIcon(Drawable icon)
Sets the context menu header's icon to the icon given in icon
Drawable . |
ContextMenu |
setHeaderIcon(int iconRes)
Sets the context menu header's icon to the icon given in iconRes
resource id.
|
ContextMenu |
setHeaderTitle(CharSequence title)
Sets the context menu header's title to the title given in title.
|
ContextMenu |
setHeaderTitle(int titleRes)
Sets the context menu header's title to the title given in titleRes
resource identifier.
|
ContextMenu |
setHeaderView(View view)
Sets the header of the context menu to the
View given in
view. |
add, add, add, add, addIntentOptions, addSubMenu, addSubMenu, addSubMenu, addSubMenu, clear, close, findItem, getItem, hasVisibleItems, isShortcutKey, performIdentifierAction, performShortcut, removeGroup, removeItem, setGroupCheckable, setGroupEnabled, setGroupVisible, setQwertyMode, size
ContextMenu setHeaderTitle(@StringRes int titleRes)
titleRes
- The string resource identifier used for the title.ContextMenu setHeaderTitle(CharSequence title)
title
- The character sequence used for the title.ContextMenu setHeaderIcon(@DrawableRes int iconRes)
iconRes
- The resource identifier used for the icon.ContextMenu setHeaderIcon(Drawable icon)
Drawable
.icon
- The Drawable
used for the icon.ContextMenu setHeaderView(View view)
View
given in
view. This replaces the header title and icon (and those
replace this).view
- The View
used for the header.void clearHeader()