androidandroid-jetpack-compose

Set background color for the whole app. Android, Jetpack Compose


I need to set background color for the whole app. In xml, we use android:background tag in fragment or activity.

What analog Compose has? Surface argument for theme colorPalette doesn't help. Look for your solutions.


Solution

  • You can place your app inside a Box with needed background:

    setContent {
        YourTheme {
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .background(Color.Yellow)
            ) {
                YourApp()
            }
        }
    }