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

Colton Idle

02/04/2022, 12:13 PM
When I add a label to my text field while it's on the screen, it shifts down just ever so slightly (to make room for the floating label text). Is there anyway to get it so that it's always at its max height so to speak even if the label is blank?
z

Zoltan Demant

02/04/2022, 12:15 PM
" "
? That works for the hint at least, havent tried with the label though.
c

Colton Idle

02/04/2022, 12:19 PM
I'm using outlined text field and so It unfortunately inserts a space into the outline. 🙃 Any other ideas? lol
z

Zoltan Demant

02/04/2022, 12:24 PM
Sorry but all I can think of is something super-hacky. You could create the label composable (with " ") and set its width to 0.dp, Im not sure if that renders anything, but if it does the height should be appropiate and result in the field not increasing in size when you do finally show the label.
c

Colton Idle

02/04/2022, 2:22 PM
Yeah. SO I ended up going the hacky route of "if the label is blank then add 8.dp of padding" and that seems to work well
¯\_(ツ)_/¯
🥲 2