Function

requestFocus

requestFocus

Source set: Android
override fun requestFocus(direction: Int, previouslyFocusedRect: Rect?): Boolean

requestFocus

Source set: Common
public fun FocusRequesterModifierNode.requestFocus(): Boolean

Use this function to request focus. If the system grants focus to a component associated with this FocusRequester, its onFocusChanged modifiers will receive a FocusState object where FocusState.isFocused is true.

requestFocus

Source set: Common
public fun SemanticsPropertyReceiver.requestFocus(
    label: String? = null,
    action: (() -> Boolean)?,
): Unit

Action that gives input focus to this node.

Parameters

label Optional label for this action.
action Action to be performed when the SemanticsActions.RequestFocus is called.
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: