Compose Unstyled 2.0 is out! Check the official announcement blog ->
Class

SpatialBiasAbsoluteAlignment

Positions content in 3D space using horizontal, vertical, and depth bias.

Source set: Android
public class SpatialBiasAbsoluteAlignment(
    @param:FloatRange(-1.0, 1.0) public val horizontalBias: Float,
    @param:FloatRange(-1.0, 1.0) public val verticalBias: Float,
    @param:FloatRange(-1.0, 1.0) public val depthBias: Float,
) : SpatialAlignment

Positions content in 3D space using horizontal, vertical, and depth bias.

Bias refers to a normalized floating-point value, typically within the range of [-1.0f, 1.0f], that determines how a child's content is positioned along a specific axis relative to its parent's available space.

  • A bias of 0.0f centers the content along that axis.
  • A bias of -1.0f aligns the content to one extreme (e.g., left for horizontal, bottom for vertical, back for depth).
  • A bias of 1.0f aligns the content to the opposite extreme (e.g., right for horizontal, top for vertical, front for depth).
  • Values between -1.0f and 1.0f linearly interpolate the position between these extremes.

Unlike SpatialBiasAlignment, the horizontalBias in this alignment is absolute; -1.0f always means left and 1.0f` always means right, irrespective of the current LayoutDirection.

Parameters

horizontalBias Must be within the range of [-1, 1] with -1 being left and 1 being right.
verticalBias Must be within the range of [-1, 1] with -1 being bottom and 1 being top.
depthBias Must be within the range of [-1, 1] with -1 being back and 1 being front.

Functions

copy

public fun copy(
        horizontalBias: Float = this.horizontalBias,
        verticalBias: Float = this.verticalBias,
        depthBias: Float = this.depthBias,
    ): SpatialBiasAbsoluteAlignment

Companion Object

Last updated: