我有一个带有文本字段的固定底部容器。我使用 imePadding 修饰符。当键盘出现时,imePadding 似乎会工作两次。它仅发生在某些设备上。特别是我的是三星 Galaxy A80 (Android 11)
代码示例
Scaffold(
modifier = Modifier.fillMaxSize(),
bottomBar = {
Box(
Modifier
.imePadding()
.height(100.dp)
.background(Color.Red),
) {
BasicTextField(
modifier = Modifier.fillMaxWidth(),
value = "some text",
onValueChange = {},
)
}
},
) {
Box(
Modifier.fillMaxSize().padding(bottom = it.calculateBottomPadding()),
) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
) {
repeat((0..100).count()) {
item {
Box(Modifier.fillMaxWidth().height(100.dp).background(Color.Blue)) {
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我添加以下内容时, UPD问题会重现:
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
Run Code Online (Sandbox Code Playgroud)