@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.FUNCTION])
@ExperimentalGlancePreviewApi
@Repeatable
annotation Preview


The annotation to be used on a Glance composable for displaying visual previews in Android Studio.

The widthDp and heightDp parameters correspond to the size of the widget, i.e. the size available in the LocalSize composition local. When widthDp and heightDp aren't specified, the visual preview wraps its content. In this case, LocalSize should not be read within the composable.

Summary

Public constructors

Preview(widthDp: Int, heightDp: Int)

Public properties

Int

height in DP that will be used when rendering the annotated Glance @Composable and that will be set as the widget's LocalSize height.

Int

width in DP that will be used when rendering the annotated Glance @Composable and that will be set as the widget's LocalSize width.

Public constructors

Preview

Preview(widthDp: Int = -1, heightDp: Int = -1)
Parameters
widthDp: Int = -1

width in DP that will be used when rendering the annotated Glance @Composable and that will be set as the widget's LocalSize width.

heightDp: Int = -1

height in DP that will be used when rendering the annotated Glance @Composable and that will be set as the widget's LocalSize height.

Public properties

heightDp

val heightDpInt

height in DP that will be used when rendering the annotated Glance @Composable and that will be set as the widget's LocalSize height.

widthDp

val widthDpInt

width in DP that will be used when rendering the annotated Glance @Composable and that will be set as the widget's LocalSize width.