SemanticsNode
class SemanticsNode
kotlin.Any | |
↳ | androidx.compose.ui.semantics.SemanticsNode |
A list of key/value pairs associated with a layout node or its subtree.
Each SemanticsNode takes its id and initial key/value list from the outermost modifier on one layout node. It also contains the "collapsed" configuration of any other semantics modifiers on the same layout node, and if "mergeDescendants" is specified and enabled, also the "merged" configuration of its subtree.
Summary
Public methods | |
---|---|
Int |
getAlignmentLinePosition(alignmentLine: AlignmentLine) Returns the position of an alignment line, or AlignmentLine.Unspecified if the line is not provided. |
Properties | |
---|---|
Rect |
The bounding box for this node relative to the root of this Compose hierarchy, with clipping applied. |
Rect |
The bounding box for this node relative to the screen, with clipping applied. |
List<SemanticsNode> |
Contains the children in inverse hit test order (i. |
SemanticsConfiguration |
The list of semantics properties of this node. |
Int | |
Boolean |
Whether this SemanticNode is the root of a tree or not |
LayoutInfo |
The LayoutInfo that this is associated with. |
Boolean |
mergingEnabled specifies whether mergeDescendants config has any effect. |
SemanticsNode? |
The parent of this node in the tree. |
Offset |
The position of this node relative to the root of this Compose hierarchy, with no clipping applied |
Offset |
The position of this node relative to the screen, with no clipping applied |
RootForTest? |
The root this node is attached to. |
IntSize |
The size of the bounding box for this node, with no clipping applied |
Public methods
getAlignmentLinePosition
fun getAlignmentLinePosition(alignmentLine: AlignmentLine): Int
Returns the position of an alignment line, or AlignmentLine.Unspecified if the line is not provided.
Properties
boundsInRoot
val boundsInRoot: Rect
The bounding box for this node relative to the root of this Compose hierarchy, with clipping applied. To get the bounds with no clipping applied, use Rect(positionInRoot, size.toSize())
boundsInWindow
val boundsInWindow: Rect
The bounding box for this node relative to the screen, with clipping applied. To get the bounds with no clipping applied, use PxBounds(positionInWindow, size.toSize())
children
val children: List<SemanticsNode>
Contains the children in inverse hit test order (i.e. paint order).
Note that if mergingEnabled and mergeDescendants are both true, then there are no children (except those that are themselves mergeDescendants).
config
val config: SemanticsConfiguration
The list of semantics properties of this node.
This includes all properties attached as modifiers to the current layout node. In addition, if mergeDescendants and mergingEnabled are both true, then it also includes the semantics properties of descendant nodes.
id
val id: Int
mergingEnabled
val mergingEnabled: Boolean
mergingEnabled specifies whether mergeDescendants config has any effect.
If true, then mergeDescendants nodes will merge up all properties from child semantics nodes and remove those children from "children", with the exception of nodes that themselves have mergeDescendants. If false, then mergeDescendants has no effect.
mergingEnabled is typically true or false consistently on every node of a SemanticsNode tree.
positionInRoot
val positionInRoot: Offset
The position of this node relative to the root of this Compose hierarchy, with no clipping applied
positionInWindow
val positionInWindow: Offset
The position of this node relative to the screen, with no clipping applied