public abstract class ActionMode extends Object
For information about how to provide contextual actions with ActionMode
,
read the Menus
developer guide.
Modifier and Type | Class and Description |
---|---|
static interface |
ActionMode.Callback
Callback interface for action modes.
|
Constructor and Description |
---|
ActionMode() |
Modifier and Type | Method and Description |
---|---|
abstract void |
finish()
Finish and close this action mode.
|
abstract View |
getCustomView()
Returns the current custom view for this action mode.
|
abstract Menu |
getMenu()
Returns the menu of actions that this action mode presents.
|
abstract MenuInflater |
getMenuInflater()
Returns a
MenuInflater with the ActionMode's context. |
abstract CharSequence |
getSubtitle()
Returns the current subtitle of this action mode.
|
Object |
getTag()
Retrieve the tag object associated with this ActionMode.
|
abstract CharSequence |
getTitle()
Returns the current title of this action mode.
|
boolean |
getTitleOptionalHint() |
abstract void |
invalidate()
Invalidate the action mode and refresh menu content.
|
boolean |
isTitleOptional() |
boolean |
isUiFocusable()
Returns whether the UI presenting this action mode can take focus or not.
|
abstract void |
setCustomView(View view)
Set a custom view for this action mode.
|
abstract void |
setSubtitle(CharSequence subtitle)
Set the subtitle of the action mode.
|
abstract void |
setSubtitle(int resId)
Set the subtitle of the action mode.
|
void |
setTag(Object tag)
Set a tag object associated with this ActionMode.
|
abstract void |
setTitle(CharSequence title)
Set the title of the action mode.
|
abstract void |
setTitle(int resId)
Set the title of the action mode.
|
void |
setTitleOptionalHint(boolean titleOptional)
Set whether or not the title/subtitle display for this action mode
is optional.
|
public void setTag(Object tag)
Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.
tag
- Tag to associate with this ActionModegetTag()
public Object getTag()
Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.
setTag(Object)
public abstract void setTitle(CharSequence title)
title
- Title string to setsetTitle(int)
,
setCustomView(View)
public abstract void setTitle(int resId)
resId
- Resource ID of a string to set as the titlesetTitle(CharSequence)
,
setCustomView(View)
public abstract void setSubtitle(CharSequence subtitle)
subtitle
- Subtitle string to setsetSubtitle(int)
,
setCustomView(View)
public abstract void setSubtitle(int resId)
resId
- Resource ID of a string to set as the subtitlesetSubtitle(CharSequence)
,
setCustomView(View)
public void setTitleOptionalHint(boolean titleOptional)
In many cases the supplied title for an action mode is merely meant to add context and is not strictly required for the action mode to be useful. If the title is optional, the system may choose to hide the title entirely rather than truncate it due to a lack of available space.
Note that this is merely a hint; the underlying implementation may choose to ignore this setting under some circumstances.
titleOptional
- true if the title only presents optional information.public boolean getTitleOptionalHint()
setTitleOptionalHint(boolean)
,
isTitleOptional()
public boolean isTitleOptional()
public abstract void setCustomView(View view)
view
- Custom view to use in place of the title/subtitle.setTitle(CharSequence)
,
setSubtitle(CharSequence)
public abstract void invalidate()
ActionMode.Callback
will have its
ActionMode.Callback.onPrepareActionMode(ActionMode, Menu)
method called.
If it returns true the menu will be scanned for updated content and any relevant changes
will be reflected to the user.public abstract void finish()
ActionMode.Callback
will
have its ActionMode.Callback.onDestroyActionMode(ActionMode)
method called.public abstract Menu getMenu()
public abstract CharSequence getTitle()
public abstract CharSequence getSubtitle()
public abstract View getCustomView()
public abstract MenuInflater getMenuInflater()
MenuInflater
with the ActionMode's context.public boolean isUiFocusable()