<h2 id="spatialandroidviewpanel-factory-modifier-update-shape-dragpolicy-resizepolicy-interactionpolicy">SpatialAndroidViewPanel</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
@Composable
@SubspaceComposable
public fun <T : View> SpatialAndroidViewPanel(
    factory: (Context) -> T,
    modifier: SubspaceModifier = SubspaceModifier,
    update: (T) -> Unit = {},
    shape: SpatialShape = SpatialPanelDefaults.shape,
    dragPolicy: DragPolicy? = null,
    resizePolicy: ResizePolicy? = null,
    interactionPolicy: InteractionPolicy? = null,
)
```

Creates a [SpatialAndroidViewPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialAndroidViewPanel) representing a 2D plane in 3D space where an Android View
will be hosted.

The presented View is obtained from `factory`. The `factory` block will be called exactly once to
obtain the [View](https://developer.android.com/reference/android/view/View) being composed into this panel, and it is also guaranteed to be executed on the
main thread. Therefore, in addition to creating the [View](https://developer.android.com/reference/android/view/View), the `factory` block can also be used
to perform one-off initializations and [View](https://developer.android.com/reference/android/view/View) constant properties' setting. The factory inside of
the constructor is used to avoid the need to pass the context to the factory. There is one [View](https://developer.android.com/reference/android/view/View)
for every [SpatialAndroidViewPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialAndroidViewPanel) instance and it is reused across recompositions. This [View](https://developer.android.com/reference/android/view/View)
is shown effectively in isolation and does not interact directly with the other composable's that
surround it. The `update` block can run multiple times (on the UI thread as well) due to
recomposition, and it is the right place to set the new properties. Note that the block will also
run once right after the `factory` block completes. [SpatialAndroidViewPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialAndroidViewPanel) will clip the view
content to fit the panel.

#### Parameters

| | |
| --- | --- |
| T | The type of the Android View to be created. |
| factory | A lambda that creates an instance of the Android View `T`. |
| modifier | SubspaceModifiers to apply to the SpatialPanel. |
| update | A lambda that allows updating the created Android View `T`. |
| shape | The shape of this Spatial Panel. |
| dragPolicy | An optional [DragPolicy](/jetpack-compose/androidx.xr.compose/compose/classes/DragPolicy) that defines the motion behavior of the [SpatialPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialPanel). This can be either a [MovePolicy](/jetpack-compose/androidx.xr.compose/compose/classes/MovePolicy) for free movement or an [AnchorPolicy](/jetpack-compose/androidx.xr.compose/compose/classes/AnchorPolicy) for anchoring to real-world surfaces. If a policy is provided, draggable UI controls will be shown, allowing the user to manipulate the panel in 3D space. If null, no motion behavior is applied. |
| resizePolicy | An optional [ResizePolicy](/jetpack-compose/androidx.xr.compose/compose/classes/ResizePolicy) configuration object that resizing behavior of this [SpatialPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialPanel). The draggable UI controls will be shown that allow the user to resize the element in 3D space. If null, there is no resize behavior applied to the element. |
| interactionPolicy | An optional [InteractionPolicy](/jetpack-compose/androidx.xr.compose/compose/classes/InteractionPolicy) that can be set to detect 3D input events. Setting this will not intercept 2D input events and is intended to provide additional spatial input information. |