I've used the primary variant color as the background of the whole app, but still, I see a white screen while the UI is loading initially. Is there any way around it?
EDIT: I've created a new empty project and applied the bellow suggestion by @Philip Dukhov. Still the same result. The white screen appears first and stays at least two seconds on the screen before the Surface starts to load.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
SOIssueReproduceTheme {
Surface(
color = MaterialTheme.colors.primaryVariant,
modifier = Modifier.fillMaxSize()
) {
Greeting("Android")
}
}
}
}
}
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
Thanks for your help!