我想用底部的支架在横向模式下填充整个屏幕,但它的左右两侧总是有一些剩余空间:
我已经删除了所有可能的填充并在各处使用了
modifier.fillMaxSize
,但空格仍然存在。
这是我使用的非常短的代码:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
TESTApplicationTheme {
MyUI()
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MyUI() {
val scaffoldState = rememberBottomSheetScaffoldState()
val coroutineScope = rememberCoroutineScope()
BottomSheetScaffold(
modifier = Modifier.fillMaxSize(),
scaffoldState = scaffoldState,
sheetContent = {
Box(modifier = Modifier.fillMaxSize().background(Color.Blue))
},
sheetDragHandle = null,
) {
// app UI
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(text = "Rest of the app UI")
Button(
onClick = {
coroutineScope.launch {
scaffoldState.bottomSheetState.expand()
}
},
) {
Text(text = "expand")
}
}
}
}