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

André Thiele

06/05/2021, 12:01 PM
How can I remove this padding from the Outlined Text Field that is reserved to the label if I dont want to show a label? Or should I wrap it and clip its contents?
c

Colton Idle

06/05/2021, 2:14 PM
n

nglauber

06/05/2021, 5:54 PM
@Colton Idle here we are again 😄 I’ll add a reference to the last time people ask this question, so we can do a stack trace 😅 https://kotlinlang.slack.com/archives/CJLTWPH7S/p1622729349245100
a

André Thiele

06/05/2021, 5:57 PM
@nglauber yea thanks, the background is only for you to see that theres a padding applied!
👍 1
n

nglauber

06/05/2021, 6:00 PM
Yeah… The padding will still be there 😕 I had a long discussion regarding this padding “issue” in TextField… If you want that for now, you must have to copy the
OutlinedTextField
implementation and remove the padding… 🤷‍♂️ It’s not so complicated actually, but Compose does not currently provide this right now.
a

André Thiele

06/05/2021, 6:01 PM
okay, will just live with it for now and. Actually I just apply top padding to other components so they are centered vertically
think smart 1
c

Colton Idle

06/05/2021, 8:17 PM
If anyone creates a gist for something that allows customizing padding, please share. 😄
n

nglauber

06/05/2021, 9:37 PM
@Colton Idle I did one to remove that horizontal padding from TextField… Basically I copied the
TextField.kt
and
TextFieldImpl.kt
and did my changes… 🤷‍♂️
👍 1
But I have to say that it was very easy to do… Google, please add a single param:
horizontalMargin
and boom: everything works and we stop to see “how can I removed the padding from TextField?” 😄
a

André Thiele

06/08/2021, 8:38 AM
After some thinking I really think this is a bug, if your lambda is empty or not provided, it should be rendered without a padding this could easily be done by overloading
c

Colton Idle

02/04/2022, 11:06 AM
n

nglauber

02/09/2022, 12:44 AM
You’re welcome 😄
This one was also fixed… 🙂 https://issuetracker.google.com/issues/187746439
1365 Views