The second Android 11 Developer Preview is now available, test it out and share your feedback.

FocusManager

interface FocusManager
androidx.ui.core.input.FocusManager

Interface of manager of focused composable.

Focus manager keeps tracking the input focused node and provides focus transitions.

Summary

Nested classes

abstract

An interface for focusable object.

Public methods

abstract Unit

Release the focus if given focus node is focused

abstract Unit

Register the focusable node with identifier.

abstract Unit

Request the input focus

abstract Unit
requestFocusById(identifier: String)

Request the focus assiciated with the identifier.

abstract Unit

Unregister the focusable node associated with given identifier.

Public methods

blur

abstract fun blur(client: FocusManager.FocusNode): Unit

Release the focus if given focus node is focused

Parameters
client: FocusManager.FocusNode A focusable client.

registerFocusNode

abstract fun registerFocusNode(
    identifier: String,
    node: FocusManager.FocusNode
): Unit

Register the focusable node with identifier.

The caller must unregister when the focusable node is disposed. This function overwrites if the focusable node is already registered.

Parameters
identifier: String focusable client identifier
node: FocusManager.FocusNode focusable client.

requestFocus

abstract fun requestFocus(client: FocusManager.FocusNode): Unit

Request the input focus

Parameters
client: FocusManager.FocusNode A focusable client.

requestFocusById

abstract fun requestFocusById(identifier: String): Unit

Request the focus assiciated with the identifier.

Do nothing if there is no focusable node assciated with given identifier.

Parameters
identifier: String The focusable node identifier.

unregisterFocusNode

abstract fun unregisterFocusNode(identifier: String): Unit

Unregister the focusable node associated with given identifier.

Parameters
identifier: String focusable client identifier