We need to add an annotation
@Preview for our
@Composable function.
Importantly! @Preview can only be used for methods without parameters.
Example:
Kotlin
@Composable
fun ShowMyText() {
Text(
text = "Hello Android!"
)
}
@Preview
@Composable
fun MyPreview1() {
ShowMyText()
}
To start
Preview, click on the
Split button: