Android Day 9 How to make customised Preview?

Realy simple, just comment the default preview and add our own , but add @Preview(showBackground = true) @Composable at the top.

//@Preview(showBackground = true)
//@Composable
//fun GreetingPreview() {
//    OurOwnComposableTheme {
//        Greeting("Android")
//    }
//}

@Preview(showBackground = true)
@Composable

fun StackOfGreetingsPreview() {
    OurOwnComposableTheme {
        StackOfGreetings()
    }

}

And the name of the fun should be exact the same as the fun you want to preview. But add preview at the end, like "StackOfGreetingsPreview()"

Voila, you got your preview:

image-20240201114649706