Hi! How can I tell a LazyRow how many items should...
# compose-desktop
f
Hi! How can I tell a LazyRow how many items should be visible. E.g. I have a list do 10 items but I want to display only items 4 to 6 or the first 3 items?
c
For what I understood about lazyRow/Column, they always take the whole list and display whatever fit his current size. Base on that, one possible way to archive that kind of behavior could be: • set via “modifier” width of the LazyRow to match the space taken by x element (3 in yours case) • Once archive that, display 1to3 or 2to5 is only matter of scrolling to desire position
f
Ok - thank you. I’ve tried that and it works.
f
Yes, you can set a constant width, but it won't adapt to changes in child size. What I did is do some hack to calculate the size with
Layout({},{))
at the start... I wonder if there is a better way to do this.