Rick Regan
09/06/2021, 1:39 AMsystemUiController.setSystemBarsColor()
to set dark icons. When I switch between apps using gesture navigation there is a lag in my test app where the system icons are momentarily white before changing back to black. Is there a way to avoid this? (Video and code in thread.)Rick Regan
09/06/2021, 1:40 AMsetContent {
val systemUiController = rememberSystemUiController()
val useDarkIcons = MaterialTheme.colors.isLight
SideEffect {
systemUiController.setSystemBarsColor(
color = Color.Gray,
darkIcons = useDarkIcons
)
}
Box (modifier = Modifier.background(Color.LightGray).fillMaxSize()) {
Text("systemUiController test")
}
}
(This is on a Pixel 4a, API 30, on the emulator.)Luis
09/06/2021, 2:04 AMAlbert Chang
09/06/2021, 2:16 AMWindowInsetsController.setSystemBarsAppearance()
, which is what accompanist uses under the hood. If you want to eliminate the lag, you need to set android:windowLightStatusBar
in your xml theme.
Edit: Tried on Android 12 and it seems that there's no lag any more so this is only a problem on Android 11.Rick Regan
09/06/2021, 2:26 AMandroid:windowLightStatusBar
(All my experience on Android is Compose -- no xml so far.) :)Rick Regan
09/06/2021, 2:45 AMAlbert Chang
09/06/2021, 2:49 AM