Live Previews with @Preview
Iterate on UI without rebuilding the whole app.
See UI Without Running
Rebuilding the whole app to check one button is slow. The @Preview annotation renders your Composable right inside Android Studio. ⚡
Add the Annotation
Put @Preview above a Composable that takes no required parameters. Android Studio then shows it in the design pane beside your code.
@Preview
@Composable
fun GreetingPreview() {
Greeting("Compose")
}All lessons in this course
- Writing a @Composable Function
- Live Previews with @Preview
- Calling Composables from Composables
- setContent: Where Your UI Begins