1

Is there a way to trigger the VisualTransformation upon focus just prior to user typing?

var text by remember { mutableStateOf("") }

OutlinedTextField(
    modifier = modifier,
    value = text,
    onValueChange = { input ->
        text = input
    },
    label = {
        Text("Input Here")
    },
    placeholder = {
        Text("$")
    }
)

In this case, I'm looking for a way to put the cursor in front or after the $ dollar sign upon focus


Something like this

enter image description here

z.g.y
  • 5,512
  • 4
  • 10
  • 36
  • 1
    Why do you want to place the cursor after the placeholder text? The placeholder text will be removed when the user starts typing. – Abhimanyu Jul 19 '23 at 06:11
  • 1
    If the cursor is placed after the placeholder text, it gives the impression that the text is prefilled, and any text that the user types will continue after the placeholder text, which is not the case with placeholder text. – Abhimanyu Jul 19 '23 at 06:14
  • Im attempting to migrate/refactor a similar existing functionality of a View counterpart, not sure if this can be solved by a VisualTransformation – z.g.y Jul 19 '23 at 08:43

0 Answers0