Jetpack Copmose, center text in TextField

Viewed 389

Is it possible to center text in TextField?

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

1 Answers

You can use:

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

enter image description here

Related