1

Is it possible to center text in TextField?

textStyle = TextStyle(textAlign = TextAlign.Center) seems not working.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Solvek
  • 5,158
  • 5
  • 41
  • 64

1 Answers1

1

You can use:

TextField(
    value = text,
    onValueChange = {text = it},
    textStyle = LocalTextStyle.current.copy(
        textAlign = TextAlign.Center
    )
)

enter image description here

Bennik2000
  • 1,112
  • 11
  • 25
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841