Tomas Gordian
03/21/2024, 11:12 AMMaterial3 ModalBottomSheet in landscape mode on mobile has an extra right inset applied when using Theme.SplashScreen. It looks like it is the same size as the navigation bar inset.Tomas Gordian
03/21/2024, 11:12 AMTomas Gordian
03/21/2024, 11:13 AMclass MainActivity : ComponentActivity() {
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
Surface(
color = Color.Green,
modifier = Modifier.fillMaxSize()
) {
val sheetState = rememberModalBottomSheetState()
val coroutineScope = rememberCoroutineScope()
LaunchedEffect(Unit) {
coroutineScope.launch {
sheetState.show()
}
}
ModalBottomSheet(
windowInsets = WindowInsets(0, 0, 0, 0),
sheetState = sheetState,
onDismissRequest = {},
modifier = Modifier.fillMaxHeight()
) {}
}
}
}
}
<style name="Theme.MyTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
<style name="Theme.MyLauncherTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@android:color/black</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher_foreground</item>
<item name="postSplashScreenTheme">@style/Theme.MyTheme</item>
</style>
Is this a known issue or is there some workaround for this? Without Theme.SplashScreen it works correctly.Stylianos Gakis
03/21/2024, 11:46 AMenableEdgeToEdge is supposed to be called before super.onCreate btw, can you change that first and see if you get a different result?Stylianos Gakis
03/21/2024, 11:48 AMTomas Gordian
03/21/2024, 11:55 AMStylianos Gakis
03/21/2024, 11:59 AMwindowInsets = WindowInsets(0, 0, 0, 0) there?Tomas Gordian
03/21/2024, 12:05 PMenableEdgeToEdge before super.onCreate as you suggested. windowInsets are set to zero for other bugs with ModalBottomSheet. But even if I remove it, it has no effect on my issue.Stylianos Gakis
03/21/2024, 12:08 PMTomas Gordian
03/21/2024, 12:18 PMStylianos Gakis
03/21/2024, 12:23 PMTomas Gordian
03/21/2024, 12:43 PMStylianos Gakis
03/21/2024, 12:47 PMTomas Gordian
03/22/2024, 2:40 PMTomas Gordian
03/22/2024, 2:56 PMModalBottomSheet issue: I noticed, that if I am using the Theme.SplashScreen , it has set:
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
I could override it in my theme to never and get rid of the extra right inset, but than I am getting black space on the left side:Stylianos Gakis
03/22/2024, 3:43 PM