我有一份文本建议芯片视图显示在文本字段上方,当用户点击芯片时,我将文本附加到文本字段中。之后,我想将光标移动到末尾位置。我在Jetpack compose中找不到解决方法。之前我们在android视图中使用editText.setSelection(position)
来更改光标位置。
如何在Jetpack Compose的TextField中设置光标位置?
OutlinedTextField(
value = value,
onValueChange = { value = it },
maxLines = 8,
label = {
Text(
text = "Content",
maxLines = 1
)
},
modifier = Modifier
.fillMaxWidth()
.height(200.dp),
shape = RoundedCornerShape(2.dp),
)