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

myanmarking

09/30/2021, 9:56 AM
it it possible to disable the label animation for OutlinedTextField? I have label and placeholder. I don’t want the label to jump around
👀 3
🧵 1
c

Csaba Kozák

09/30/2021, 10:57 AM
I think you have to create your own text field component to do that.
m

myanmarking

09/30/2021, 10:57 AM
yes. that’s what i am doing atm 😛 thank
z

Zoltan Demant

09/30/2021, 11:08 AM
Im in a similar spot. It might be worth exploring using an empty string for the empty state (" ") which floats the label to the top, then adjusting it with
Modifier.onFocusChanged
such that the input string is actually empty ("") when focus is gained and the user is ready to input text, then setting it back to (" ") when focus is lost if the input is still empty. I dont know if this has any other side effects, in theory it should work, but I havent tried it yet. In my case Im reluctant to create a custom BasicTextField due to the maintenance overhead it implies in the long run. If you do decide to try it, let me know - Id love to know the results. I might update later on if I do decide to try it myself too!
m

myanmarking

09/30/2021, 11:09 AM
i just made my own column component. i needed fixed label, hint and error
its actually pretty easy!
z

Zoltan Demant

09/30/2021, 12:55 PM
Glad that works for you! 👍🏽👍🏽
2 Views