androidx.xr.compose.subspace

Interfaces

FollowTarget

A FollowTarget can be used with androidx.xr.compose.spatial.FollowingSubspace to have a set of content follow a target such as an anchor or AR device.

SceneCoreEntitySizeAdapter

The sizing strategy used by SceneCoreEntity to control and read the size of an entity.

SpatialBoxScope

Scope for the children of SpatialBox.

SpatialColumnScope

Scope for customizing the layout of children within a SpatialColumn.

SpatialExternalSurfaceScope

SpatialExternalSurfaceScope is a scoped environment that provides the Surface associated with a SpatialExternalSurface

SpatialGltfModelSource

Defines the source for a 3D model to be rendered by the SpatialGltfModel composable.

SpatialRowScope

Scope for customizing the layout of children within a SpatialRow.

Classes

AnchorPolicy

Represents the anchoring behavior of a spatial object.

DragPolicy

Base Policy for motion behavior of spatial objects.

FollowBehavior

A FollowBehavior controls the motion of content as it is following another target, such as a user's head.

MovePolicy

This class is deprecated. Use SubspaceModifier.movable() instead.

ResizePolicy

Defines the resizing policy for a spatial object.

SpatialExternalSurfaceProtection

Specifies if the Surface should be backed by android.hardware.HardwareBuffers with the USAGE_PROTECTED_CONTENT flag set.

SpatialGltfModelAnimation

An animation that is attached to a glTF model.

SpatialGltfModelAnimation.AnimationState

The current animation state of the SpatialGltfModelAnimation.

SpatialGltfModelState

A state object that can be hoisted to observe and control a SpatialGltfModel.

SpatialGltfModelStatus

An object that describes and contains information relevant to the current loading state of the glTF model.

SpatialGltfModelStatus.Failed

The glTF model has failed to load properly.

SpatialGltfModelStatus.Loaded

The glTF model is fully loaded and ready to be displayed.

SpatialGltfModelStatus.Loading

The glTF model is currently loading and is not ready to be displayed.

StereoMode

Mode for SpatialExternalSurface display.

SuperSamplingPattern

Specifies the super sampling setting for this Surface.

TrackedDimensions

A set of boolean flags which determine the dimensions of movement that are tracked.

Exceptions

GltfLoadException

Exception thrown when a glTF model fails to load.

Objects

SpatialCurvedRowDefaults

Contains the default values used by SpatialCurvedRow.

SpatialPanelDefaults

Contains default values used by spatial panels.

Annotations

SubspaceComposable

Marks a composable function or other code element as intended for use within the context of SubspaceComposable functions.

Composables

SceneCoreEntity

A composable that attaches to a SceneCore entity and allow compose to size, position, reparent, add children, and apply modifiers to the entity.

SpatialActivityPanel

Creates a SpatialActivityPanel and launches an Activity within it.

SpatialAndroidViewPanel

Creates a SpatialAndroidViewPanel representing a 2D plane in 3D space where an Android View will be hosted.

SpatialBox

A layout composable that sizes itself to fit its content, subject to incoming constraints.

SpatialColumn

A layout composable that arranges its children in a vertical sequence.

SpatialCurvedRow

A layout composable that arranges its children in a curved horizontal sequence.

SpatialExternalSurface

A Composable that creates and owns an Android Surface into which the application can render stereo image content.

SpatialExternalSurfaceHemisphere

A Composable that creates and owns an Android Surface into which the application can render stereo image content inside a 180 degree hemisphere dome.

SpatialExternalSurfaceSphere

A Composable that creates and owns an Android Surface into which the application can render stereo image content inside a 360 degree sphere dome.

SpatialGltfModel

This composable renders a glTF or .glb model that is loaded asynchronously from the provided source.

SpatialMainPanel

A composable that renders the Activity's main window's 2D UI content, defined in androidx.activity.compose.setContent, as a panel in a Subspace.

SpatialPanel

Creates a SpatialPanel representing a 2D plane in 3D space in which an application can fill content.

SpatialRow

A layout composable that arranges its children in a horizontal sequence.

SpatialSpacer

A composable that represents an empty space layout.

rememberSpatialGltfModelState

Remembers a SpatialGltfModelState object for use with the SpatialGltfModel API.

Type aliases

SurfaceProtection

This type alias is deprecated. Use SpatialExternalSurfaceProtection instead.

Top-level functions summary

SceneCoreEntitySizeAdapter<T>
<T : Entity> SceneCoreEntitySizeAdapter(
    onLayoutSizeChanged: T.(IntVolumeSize) -> Unit,
    intrinsicSize: (T.() -> IntVolumeSize)?
)

This function is deprecated. SceneCoreEntitySizeAdapter is now an interface and intrinsicSize has been renamed to currentSize.

Top-level functions

SceneCoreEntitySizeAdapter

fun <T : Entity> SceneCoreEntitySizeAdapter(
    onLayoutSizeChanged: T.(IntVolumeSize) -> Unit,
    intrinsicSize: (T.() -> IntVolumeSize)? = null
): SceneCoreEntitySizeAdapter<T>

The sizing strategy used by SceneCoreEntity to control and read the size of an entity.

The developer should use onLayoutSizeChanged to apply compose layout size changes to the entity. Compose will not inherently affect the size of the Entity.

If the developer uses onLayoutSizeChanged to change the size of the entity, but intrinsicSize is not provided, then the intrinsic size of the entity will be ignored and the layout size as determined solely by compose will be used to size the entity. If the SceneCoreEntity has no children or size modifiers then compose doesn't know how to size this node and it will be size 0, causing it not to render at all. In such a case, please do one of the following: (1) provide intrinsicSize so compose can infer the size from the entity, (2) add a sizing modifier to control the size of the entity, or (3) remove the adapter from the SceneCoreEntity as without an adapter compose will not try to control the size of this entity.

Note that many SceneCore entities accept sizes in meter units instead of pixels. The Meter type may be used to convert from pixels to meters.

Meter.fromPixel(px, density).toM()

Deprecated constructor function to maintain backwards compatibility after changing SceneCoreEntitySizeAdapter from a class to an interface.

Parameters
onLayoutSizeChanged: T.(IntVolumeSize) -> Unit

a callback that is invoked with the final layout size of the composable in pixels.

intrinsicSize: (T.() -> IntVolumeSize)? = null

a getter method that returns the current IntVolumeSize in pixels of the entity. This isn't as critical for compose as onLayoutSizeChanged; however, this can help to inform compose of the intrinsic size of the entity.