WearWidgetPreview

Functions summary

Unit
@Composable
WearWidgetPreview(
    widget: GlanceWearWidget,
    params: WearWidgetParams,
    modifier: Modifier
)

Renders a preview of a GlanceWearWidget in Android Studio.

Functions

@Composable
fun WearWidgetPreview(
    widget: GlanceWearWidget,
    params: WearWidgetParams,
    modifier: Modifier = Modifier
): Unit

Renders a preview of a GlanceWearWidget in Android Studio.

This utility facilitates rapid development by allowing developers to visualize how their Glance Wear widgets will appear on various device configurations without deploying to a physical device or emulator. It uses the provided WearWidgetParams to represent the widget's layout, including dimensions, padding, and container shape.

Parameters
widget: GlanceWearWidget

The GlanceWearWidget instance to be previewed.

params: WearWidgetParams

The WearWidgetParams to configure parameters (size, shape, padding) for the widget container.

modifier: Modifier = Modifier

The Modifier to be applied to the container box hosting the widget preview. Note that the preview's dimensions are enforced internally based on the provided params. Applying layout-modifying modifiers here might conflict with these internal specifications.