在我的代码中,编辑输入正在动态添加到 ui:
val content: Content by model.content.observeAsState(NoContent)
val editContent: EditContent? = content as? EditContent
if (editContent != null) {
var text by rememberSaveable{ mutableStateOf( editContent.currentValue?.toString() ?: "") }
TextField(value = text, onValueChange = {text = it})
}
如何使TextField
在添加后立即聚焦并出现软件键盘?