ActionMode
abstract class ActionMode
kotlin.Any | |
↳ | androidx.appcompat.view.ActionMode |
Represents a contextual mode of the user interface. Action modes can be used to provide alternative interaction modes and replace parts of the normal UI until finished. Examples of good action modes include text selection and contextual actions.
Summary
Nested classes |
|
---|---|
abstract |
Callback interface for action modes. |
Public constructors |
|
---|---|
<init>() Represents a contextual mode of the user interface. |
Public methods |
|
---|---|
abstract Unit |
finish() Finish and close this action mode. |
abstract View! |
Returns the current custom view for this action mode. |
abstract Menu! |
getMenu() Returns the menu of actions that this action mode presents. |
abstract MenuInflater! |
Returns a |
abstract CharSequence! |
Returns the current subtitle of this action mode. |
open Any! |
getTag() Retrieve the tag object associated with this ActionMode. |
abstract CharSequence! |
getTitle() Returns the current title of this action mode. |
open Boolean | |
abstract Unit |
Invalidate the action mode and refresh menu content. |
open Boolean | |
abstract Unit |
setCustomView(view: View!) Set a custom view for this action mode. |
abstract Unit |
setSubtitle(subtitle: CharSequence!) Set the subtitle of the action mode. |
abstract Unit |
setSubtitle(resId: Int) Set the subtitle of the action mode. |
open Unit |
Set a tag object associated with this ActionMode. |
abstract Unit |
setTitle(title: CharSequence!) Set the title of the action mode. |
abstract Unit |
Set the title of the action mode. |
open Unit |
setTitleOptionalHint(titleOptional: Boolean) Set whether or not the title/subtitle display for this action mode is optional. |
Public constructors
<init>
ActionMode()
Represents a contextual mode of the user interface. Action modes can be used to provide alternative interaction modes and replace parts of the normal UI until finished. Examples of good action modes include text selection and contextual actions.
Public methods
finish
abstract fun finish(): Unit
Finish and close this action mode. The action mode's ActionMode.Callback
will have its Callback#onDestroyActionMode(ActionMode)
method called.
getCustomView
abstract fun getCustomView(): View!
Returns the current custom view for this action mode.
Return | |
---|---|
View!: The current custom view |
getMenu
abstract fun getMenu(): Menu!
Returns the menu of actions that this action mode presents.
Return | |
---|---|
Menu!: The action mode's menu. |
getMenuInflater
abstract fun getMenuInflater(): MenuInflater!
Returns a MenuInflater
with the ActionMode's context.
getSubtitle
abstract fun getSubtitle(): CharSequence!
Returns the current subtitle of this action mode.
Return | |
---|---|
CharSequence!: Subtitle text |
getTag
open fun getTag(): Any!
Retrieve the tag object associated with this ActionMode.
Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.
Return | |
---|---|
Any!: Tag associated with this ActionMode |
See Also
getTitle
abstract fun getTitle(): CharSequence!
Returns the current title of this action mode.
Return | |
---|---|
CharSequence!: Title text |
getTitleOptionalHint
open fun getTitleOptionalHint(): Boolean
Return | |
---|---|
Boolean: true if this action mode has been given a hint to consider the title/subtitle display to be optional. |
invalidate
abstract fun invalidate(): Unit
Invalidate the action mode and refresh menu content. The mode's ActionMode.Callback
will have its 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.
isTitleOptional
open fun isTitleOptional(): Boolean
Return | |
---|---|
Boolean: true if this action mode considers the title and subtitle fields as optional. Optional titles may not be displayed to the user. |
setCustomView
abstract fun setCustomView(view: View!): Unit
Set a custom view for this action mode. The custom view will take the place of the title and subtitle. Useful for things like search boxes.
Parameters | |
---|---|
view |
View!: Custom view to use in place of the title/subtitle. |
setSubtitle
abstract fun setSubtitle(subtitle: CharSequence!): Unit
Set the subtitle of the action mode. This method will have no visible effect if a custom view has been set.
Parameters | |
---|---|
subtitle |
CharSequence!: Subtitle string to set |
setSubtitle
abstract fun setSubtitle(resId: Int): Unit
Set the subtitle of the action mode. This method will have no visible effect if a custom view has been set.
Parameters | |
---|---|
resId |
Int: Resource ID of a string to set as the subtitle |
setTag
open fun setTag(tag: Any!): Unit
Set a tag object associated with this ActionMode.
Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.
Parameters | |
---|---|
tag |
Any!: Tag to associate with this ActionMode |
See Also
setTitle
abstract fun setTitle(title: CharSequence!): Unit
Set the title of the action mode. This method will have no visible effect if a custom view has been set.
Parameters | |
---|---|
title |
CharSequence!: Title string to set |
See Also
setTitle
abstract fun setTitle(resId: Int): Unit
Set the title of the action mode. This method will have no visible effect if a custom view has been set.
Parameters | |
---|---|
resId |
Int: Resource ID of a string to set as the title |
setTitleOptionalHint
open fun setTitleOptionalHint(titleOptional: Boolean): Unit
Set whether or not the title/subtitle display for this action mode is optional.
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.
Parameters | |
---|---|
titleOptional |
Boolean: true if the title only presents optional information. |