Skip to content

Most visited

Recently visited



public static abstract class ActionMode.Callback2
extends Object implements ActionMode.Callback

   ↳ android.view.ActionMode.Callback2

Extension of ActionMode.Callback to provide content rect information. This is required for ActionModes with dynamic positioning such as the ones with type TYPE_FLOATING to ensure the positioning doesn't obscure app content. If an app fails to provide a subclass of this class, a default implementation will be used.


Public constructors


Public methods

void onGetContentRect(ActionMode mode, View view, Rect outRect)

Called when an ActionMode needs to be positioned on screen, potentially occluding view content.

Inherited methods

From class java.lang.Object
From interface android.view.ActionMode.Callback

Public constructors


added in API level 23
ActionMode.Callback2 ()

Public methods


added in API level 23
void onGetContentRect (ActionMode mode, 
                View view, 
                Rect outRect)

Called when an ActionMode needs to be positioned on screen, potentially occluding view content. Note this may be called on a per-frame basis.

mode ActionMode: The ActionMode that requires positioning.

view View: The View that originated the ActionMode, in whose coordinates the Rect should be provided.

outRect Rect: The Rect to be populated with the content position. Use this to specify where the content in your app lives within the given view. This will be used to avoid occluding the given content Rect with the created ActionMode.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)