Function

captureFocus

Deny requests to clear focus.

captureFocus

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

Deny requests to clear focus.

Use this function to send a request to capture focus. If a component captures focus, it will send a FocusState object to its associated onFocusChanged modifiers where [FocusState.isCaptured]() == true.

When a component is in a Captured state, all focus requests from other components are declined.

Return

true if the focus was successfully captured by one of the focus modifiers associated with this FocusRequester. False otherwise.

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: