https://kotlinlang.org logo
#compose
Title
# compose
p

Philip Blandford

08/11/2020, 10:17 AM
If I try to specify the width of a TextField, it sets the editable section to that width, but centres it in a fixed-width container. Is this expected behaviour? It's certainly not what I expected...
Copy code
Column {
  TextField(value = "", onValueChange = { }, label = {}, modifier = Modifier.width(50.dp))
  TextField(value = "", onValueChange = { }, label = {}, modifier = Modifier.width(100.dp))
  TextField(value = "", onValueChange = { }, label = {}, modifier = Modifier.width(150.dp))

}
z

Zach Klippenstein (he/him) [MOD]

08/11/2020, 4:05 PM
You can specify the gravity for the children to change that centering behavior
1
v

Vinay Gaba

08/11/2020, 4:08 PM
Although, there is some inconsistency across the composables when it comes to the default behavior.
4 Views