You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Compose ModalBottomSheetLayout 键盘弹出时UI异常问题求助

Compose ModalBottomSheetLayout 键盘弹出时UI异常问题求助

各位好,我碰到了一个挺奇怪的UI小问题:当ModalBottomSheetLayout处于展开状态时,弹出键盘会导致键盘区域出现UI错乱的情况。

以下是我复现问题的代码:

@Composable
@OptIn(ExperimentalMaterialApi::class)
fun ModalBottomSheetSample() {

    val state = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden, skipHalfExpanded = true)
    val scope = rememberCoroutineScope()

    ModalBottomSheetLayout(
        sheetState = state,
        sheetContent = {
            Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
                repeat(20) {
                    TextField(value = "", onValueChange = {})
                }
            }
        }
    ) {
        Button(onClick = { scope.launch { state.show() } }) {
            Text("Click to show sheet")
        }
    }
}

我还录制了视频来展示这个异常现象,能直观看到键盘弹出时的UI错乱情况。

有没有大佬知道该怎么解决这个问题呀?

备注:内容来源于stack exchange,提问作者gellyke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 15:28:11