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.
  • vertical, back for depth).

  • A bias of -1.0f aligns the content to one extreme (e.g., left for horizontal, bottom for
  • vertical, front for depth).

  • A bias of 1.0f aligns the content to the opposite extreme (e.g., right for horizontal, top for
  • 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

align

Source set: Android
override fun align(
        size: IntVolumeSize,
        space: IntVolumeSize,
        layoutDirection: LayoutDirection,
    ): Vector3

copy

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

equals

Source set: Android
override fun equals(other: Any?): Boolean

hashCode

Source set: Android
override fun hashCode(): Int

toString

Source set: Android
override fun toString(): String

Members

Horizontal

Source set: Android
public class Horizontal(@param:FloatRange(-1.0, 1.0) public val horizontalBias: Float) :
        SpatialAlignment.Horizontal

Creates a weighted alignment that specifies a horizontal bias and independent of layout direction

Parameters

horizontalBias Must be within the range of [-1, 1] with -1 being left and 1 being right.

Functions

align

Source set: Android
override fun align(size: Int, space: Int, layoutDirection: LayoutDirection): Int

equals

Source set: Android
override fun equals(other: Any?): Boolean

hashCode

Source set: Android
override fun hashCode(): Int

toString

Source set: Android
override fun toString(): String

copy

Source set: Android
public fun copy(bias: Float = this.horizontalBias): Horizontal

Companion

Source set: Android
public companion object
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: