Hi guys, In my screen I've set `verticalArrangem...
# compose-android
s
Hi guys, In my screen I've set
verticalArrangement = Arrangement.spacedBy(16.dp)
to LazyColumn. But I want to remove that padding from the very 1st child inside that lazy list, is there a way? P.S. I tried to use
Modifier.layout { ...
but because my items don't have minHeight defined, it's throws exception when tried to get the constraints.maxHeigh.
c
Have you tried the
contentPadding
parameter to LazyList?
s
I also have
contentPadding
in my LazyColumn. But
contentPadding
is to add a padding before the first item or after the last one. I want to add a spacing between each item, so I used
verticalArrangement
.
c
Do you have a screenshot of what you're trying to achieve?
s
Sure, here is the visual representation of what I have and what I wan to achieve.
c
So, if you have both
contentPadding
and
verticalArrangement
, then your "Current" is what your list will look like at rest. Then, when you start scrolling, it will look like your "Desired". Do you want your list to look like your "Desired" even before you start scrolling? In that case I think you should set your
contentPadding
to have top -
0.dp
1
s
Yes, I want the list to look like "Desired" even before you start scrolling. For your suggestion to set
contentPadding
to have top -
0.dp
-> We cannot set negative values to paddings in compose.
That's why I tried using
Modifier.layout { ...
to set the negative paddings with offset, but sadly cannot as my items don't have minimum height.
s
If your LazyColumn has 0.dp for contentPadding, and you got
Arrangement.spacedBy(16.dp)
for them items themselves there should just not be any space at the top anyway, what are you referring to when you mention negative padding?
c
I meant
top = 0.dp
, not top - 0.dp.
👆 1
😅 1
👍 1
s
Got it, setting the contentPadding top to
0.dp
works. Thanks guys! 🙌