android 编写ModalBottomSheetLayout键盘问题

rdlzhqv9  于 2023-03-16  发布在  Android
关注(0)|答案(1)|浏览(149)

当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")
        }
    }
}

这是一个视频https://drive.google.com/file/d/1IMU4kGY3hnixK6bVME1iqH0aPDe4-hjr/view?usp=sharing
有人知道怎么修吗?

ztyzrc3y

ztyzrc3y1#

尝试添加

windowSoftInputMode adjustResize

到您的fragment/activity

相关问题