Google berkomitmen untuk mendorong terwujudnya keadilan ras bagi komunitas Kulit Hitam. Lihat caranya.

SemanticsPropertyKey

class SemanticsPropertyKey<T>
kotlin.Any
   ↳ androidx.compose.ui.semantics.SemanticsPropertyKey

Summary

Public constructors
<init>(name: String, mergePolicy: (T?, T) -> T? = { parentValue, childValue -> parentValue ?: childValue })

Public methods
operator T
getValue(thisRef: SemanticsPropertyReceiver, property: KProperty<*>)

Throws UnsupportedOperationException.

T?
merge(parentValue: T?, childValue: T)

Method implementing the semantics merge policy of a particular key.

operator Unit
setValue(thisRef: SemanticsPropertyReceiver, property: KProperty<*>, value: T)

String

Properties
String

The name of the property.

Public constructors

<init>

SemanticsPropertyKey(
    name: String,
    mergePolicy: (T?, T) -> T? = { parentValue, childValue -> parentValue ?: childValue })

Public methods

getValue

operator fun getValue(
    thisRef: SemanticsPropertyReceiver,
    property: KProperty<*>
): T

Throws UnsupportedOperationException. Should not be called.

merge

fun merge(
    parentValue: T?,
    childValue: T
): T?

Method implementing the semantics merge policy of a particular key.

When mergeAllDescendants is set on a semantics node, then this function will called for each descendant node of a given key in depth-first-search order. The parent value accumulates the result of merging the values seen so far, similar to reduce().

The default implementation returns the parent value if one exists, otherwise uses the child element. This means by default, a SemanticsNode with mergeAllDescendants = true winds up with the first value found for each key in its subtree in depth-first-search order.

setValue

operator fun setValue(
    thisRef: SemanticsPropertyReceiver,
    property: KProperty<*>,
    value: T
): Unit

toString

fun toString(): String

Properties

name

val name: String

The name of the property. Should be the same as the constant from which it is accessed.