{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

TextToolbar

public interface TextToolbar


Interface for text-related toolbar.

Summary

Public methods

abstract @NonNull TextToolbarStatus

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

abstract void

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

abstract void
showMenu(
    @NonNull Rect rect,
    Function0<Unit> onCopyRequested,
    Function0<Unit> onPasteRequested,
    Function0<Unit> onCutRequested,
    Function0<Unit> onSelectAllRequested
)

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

Public methods

getStatus

abstract @NonNull TextToolbarStatus getStatus()

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

hide

abstract void hide()

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

showMenu

abstract void showMenu(
    @NonNull Rect rect,
    Function0<Unit> onCopyRequested,
    Function0<Unit> onPasteRequested,
    Function0<Unit> onCutRequested,
    Function0<Unit> onSelectAllRequested
)

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

Parameters
@NonNull Rect rect

region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system.

Function0<Unit> onCopyRequested

callback to copy text into ClipBoardManager.

Function0<Unit> onPasteRequested

callback to get text from ClipBoardManager and paste it.

Function0<Unit> onCutRequested

callback to cut text and copy the text into ClipBoardManager.