Interface

InteractionPolicy

Defines the InteractionPolicy for a spatial object.

Source set: Android
public interface InteractionPolicy

Defines the InteractionPolicy for a spatial object. This policy enables reacting to a SpatialInputEvent from the user. An InteractionPolicy will not propagate to children, for example, an attached androidx.xr.compose.spatial.Orbiter.

Properties

isEnabled

Source set: Android
public val isEnabled: Boolean

Whether an interaction policy is enabled for this object. If false, spatial interaction input events will not be returned.

Functions

onInputEvent

Source set: Android
public fun onInputEvent(event: SpatialInputEvent)

Raw event executed with every input update.

Members

Companion

Source set: Android
public companion object

Functions

clickable

Source set: Android
public fun clickable(isEnabled: Boolean = true, onClick: () -> Unit): InteractionPolicy

An InteractionPolicy that detects only click inputs

Parameters

isEnabled Whether an interaction policy is enabled for this object. If false, click events will not be returned.
onClick Executed after a click occurs.

Return

an InteractionPolicy that filters for click events.

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: