0PricingLogin
Jetpack Compose Academy · Lesson

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

  1. Writing a @Composable Function
  2. Live Previews with @Preview
  3. Calling Composables from Composables
  4. setContent: Where Your UI Begins
← Back to Jetpack Compose Academy