英文:
How to lock LabelText in OutlinedTextField?
问题
我有一个用于OutlinedTextField字段的标题。它只在我点击字段并开始输入时出现。有没有办法修复我的标签,使其位置始终保持在顶部?
我希望始终只有第一个版本
英文:
I have a header for an OutlinedTextField field. He show up. only when I click on the field and start typing. Is there a way to fix my label so that the position always stays on top?
When the user doesn't type anything:
I want to always have only the first version
答案1
得分: 1
如果您需要将光标放在OutlinedTextField
上,FocusRequester将会有所帮助。
val focusRequester = FocusRequester()
LaunchedEffect(Unit) {
focusRequester.requestFocus()
}
然后将其应用于您的OutlinedTextField
,如下所示:Modifier.focusRequester(focusRequester)
。
英文:
If you need cursor on the OutlinedTextField
, FocusRequester will help you
val focusRequester = FocusRequester()
LaunchedEffect(Unit) {
focusRequester.requestFocus()
}
and then apply it to your OutlinedTextField
as Modifier
.focusRequester(focusRequester)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论