Google is committed to advancing racial equity for Black communities. See how.

TextToolbar

interface TextToolbar
androidx.compose.ui.platform.TextToolbar

Interface for text-related toolbar.

Summary

Public methods
abstract Unit

Hide the floating toolbar(post-M) or primary toolbar(pre-M).

abstract Unit
showMenu(rect: Rect, onCopyRequested: ActionCallback? = null, onPasteRequested: ActionCallback? = null, onCutRequested: ActionCallback? = null, onSelectAllRequested: ActionCallback? = null)

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

Properties
abstract TextToolbarStatus

Return the TextToolbarStatus to check if the toolbar is shown or hidden.

Public methods

hide

abstract fun hide(): Unit

Hide the floating toolbar(post-M) or primary toolbar(pre-M).

showMenu

abstract fun showMenu(
    rect: Rect,
    onCopyRequested: ActionCallback? = null,
    onPasteRequested: ActionCallback? = null,
    onCutRequested: ActionCallback? = null,
    onSelectAllRequested: ActionCallback? = null
): Unit

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

Parameters
rect: Rect region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system.
onCopyRequested: ActionCallback? = null callback to copy text into ClipBoardManager.
onPasteRequested: ActionCallback? = null callback to get text from ClipBoardManager and paste it.
onCutRequested: ActionCallback? = null callback to cut text and copy the text into ClipBoardManager.

Properties

status

abstract val status: TextToolbarStatus

Return the TextToolbarStatus to check if the toolbar is shown or hidden.

Return
TextToolbarStatus of TextToolbar.