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

androidx.ui.semantics

Classes

AccessibilityAction

Data class for standard accessibility action.

AccessibilityRangeInfo

CustomAccessibilityAction

Data class for custom accessibility action.

SemanticsPropertyKey

Top-level functions summary

Unit
Semantics(container: Boolean = false, mergeAllDescendants: Boolean = false, properties: SemanticsPropertyReceiver.() -> Unit = null, children: () -> Unit)

Extension functions summary

For SemanticsPropertyReceiver
Unit
SemanticsPropertyReceiver.ScrollTo(label: String? = null, action: (x: Float, y: Float) -> Boolean)

This function adds the SemanticsActions.ScrollTo to the SemanticsPropertyReceiver.

Unit
SemanticsPropertyReceiver.onClick(label: String? = null, action: () -> Boolean)

This function adds the SemanticsActions.OnClick to the SemanticsPropertyReceiver.

Unit
SemanticsPropertyReceiver.scrollBackward(label: String? = null, action: () -> Boolean)

This function adds the SemanticsActions.ScrollBackward to the SemanticsPropertyReceiver.

Unit
SemanticsPropertyReceiver.scrollForward(label: String? = null, action: () -> Boolean)

This function adds the SemanticsActions.ScrollForward to the SemanticsPropertyReceiver.

Unit
SemanticsPropertyReceiver.setProgress(label: String? = null, action: (progress: Float) -> Boolean)

This function adds the SemanticsActions.SetProgress to the SemanticsPropertyReceiver.

Extension properties summary

For SemanticsPropertyReceiver
AccessibilityAction<(x: Float, y: Float) -> Boolean>

Action to scroll to a specified position.

String

Developer-set content description of the semantics node.

String

Developer-set state description of the semantics node.

AccessibilityRangeInfo

The node is a range with current value.

List<CustomAccessibilityAction>

Custom actions which are defined by app developers.

Boolean

Whether this semantics node is enabled.

Boolean

Whether this semantics node is hidden.

AccessibilityAction<() -> Boolean>

Action to be performed when the node is clicked.

Boolean

Whether this semantics node represents a Popup.

AccessibilityAction<() -> Boolean>

Action to scroll the content backward.

AccessibilityAction<() -> Boolean>

Action to scroll the content forward.

AccessibilityAction<(progress: Float) -> Boolean>

Action to set slider progress.

String

Test tag attached to this semantics node.

AnnotatedString

Text of the semantics node.

Top-level functions

Semantics

@Composable fun Semantics(
    container: Boolean = false,
    mergeAllDescendants: Boolean = false,
    properties: SemanticsPropertyReceiver.() -> Unit = null,
    children: () -> Unit
): Unit

Deprecated.

Extension functions

ScrollTo

fun SemanticsPropertyReceiver.ScrollTo(
    label: String? = null,
    action: (x: Float, y: Float) -> Boolean
): Unit

This function adds the SemanticsActions.ScrollTo to the SemanticsPropertyReceiver.

Parameters
label: String? = null Optional label for this action.
action: (x: Float, y: Float) -> Boolean Action to be performed when the SemanticsActions.ScrollTo is called.

onClick

fun SemanticsPropertyReceiver.onClick(
    label: String? = null,
    action: () -> Boolean
): Unit

This function adds the SemanticsActions.OnClick to the SemanticsPropertyReceiver.

Parameters
label: String? = null Optional label for this action.
action: () -> Boolean Action to be performed when the SemanticsActions.OnClick is called.

scrollBackward

fun SemanticsPropertyReceiver.scrollBackward(
    label: String? = null,
    action: () -> Boolean
): Unit

Deprecated.

This function adds the SemanticsActions.ScrollBackward to the SemanticsPropertyReceiver.

Parameters
label: String? = null Optional label for this action.
action: () -> Boolean Action to be performed when the SemanticsActions.ScrollBackward is called.

scrollForward

fun SemanticsPropertyReceiver.scrollForward(
    label: String? = null,
    action: () -> Boolean
): Unit

Deprecated.

This function adds the SemanticsActions.ScrollForward to the SemanticsPropertyReceiver.

Parameters
label: String? = null Optional label for this action.
action: () -> Boolean Action to be performed when the SemanticsActions.ScrollForward is called.

setProgress

fun SemanticsPropertyReceiver.setProgress(
    label: String? = null,
    action: (progress: Float) -> Boolean
): Unit

This function adds the SemanticsActions.SetProgress to the SemanticsPropertyReceiver.

Parameters
label: String? = null Optional label for this action.
action: (progress: Float) -> Boolean Action to be performed when the SemanticsActions.SetProgress is called.

Extension properties

ScrollTo

var SemanticsPropertyReceiver.ScrollTo: AccessibilityAction<(x: Float, y: Float) -> Boolean>

Action to scroll to a specified position.

accessibilityLabel

var SemanticsPropertyReceiver.accessibilityLabel: String

Developer-set content description of the semantics node. If this is not set, accessibility services will present the text of this node as content part.

accessibilityValue

var SemanticsPropertyReceiver.accessibilityValue: String

Developer-set state description of the semantics node. For example: on/off. If this not set, accessibility services will derive the state from other semantics properties, like AccessibilityRangeInfo, but it is not guaranteed and the format will be decided by accessibility services.

accessibilityValueRange

var SemanticsPropertyReceiver.accessibilityValueRange: AccessibilityRangeInfo

The node is a range with current value.

customActions

var SemanticsPropertyReceiver.customActions: List<CustomAccessibilityAction>

Custom actions which are defined by app developers.

enabled

var SemanticsPropertyReceiver.enabled: Boolean

Whether this semantics node is enabled.

hidden

var SemanticsPropertyReceiver.hidden: Boolean

Whether this semantics node is hidden.

onClick

var SemanticsPropertyReceiver.onClick: AccessibilityAction<() -> Boolean>

Action to be performed when the node is clicked.

var SemanticsPropertyReceiver.popup: Boolean

Whether this semantics node represents a Popup. Not to be confused with if this node is part of a Popup.

scrollBackward

var SemanticsPropertyReceiver.scrollBackward: AccessibilityAction<() -> Boolean>

Deprecated.

Action to scroll the content backward.

scrollForward

var SemanticsPropertyReceiver.scrollForward: AccessibilityAction<() -> Boolean>

Deprecated.

Action to scroll the content forward.

setProgress

var SemanticsPropertyReceiver.setProgress: AccessibilityAction<(progress: Float) -> Boolean>

Action to set slider progress.

testTag

var SemanticsPropertyReceiver.testTag: String

Test tag attached to this semantics node.

text

var SemanticsPropertyReceiver.text: AnnotatedString

Text of the semantics node. It must be real text instead of developer-set content description.