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

mcpiroman

11/29/2021, 7:37 PM
How do I get proper
fillMaxWidth
inside sth with `horizontalScroll`(by default it is ignored)? I simply want the background to span all available width.
z

Zach Klippenstein (he/him) [MOD]

11/29/2021, 7:42 PM
If you use a lazy row, you can use
fillMaxParentWidth
(docs), otherwise you could use
BoxWithConstraints
to get the available max constraints before the scrollable.
m

mcpiroman

11/29/2021, 7:54 PM
So with `BoxWithConstraints`I would measure the space, inside it use a scrollable, inside it use the max constraint as a width? Might not work if there is a padding applied along the way but will try.
z

Zach Klippenstein (he/him) [MOD]

11/29/2021, 7:59 PM
Yea, if you have a more complex layout it might be better to just use a custom layout and make your own
fillMaxParentWidth
-like modifier
c

Chris Sinco [G]

11/29/2021, 9:50 PM
Also it seems you are wanting to build a Pager/Carousel with the LazyRow? You might want to check out the Accompanist Pager as well: https://google.github.io/accompanist/pager/
m

mcpiroman

11/30/2021, 9:36 AM
Thanks but not, I have a tree view over a `Column`(and so I want each node to highlight at full width when selected, just like in IJ) and then it's actually CfD
c

Chris Sinco [G]

11/30/2021, 4:51 PM
Ah I see I misunderstood 🤦
Have you posted a similar question in #compose-desktop?
m

mcpiroman

11/30/2021, 4:55 PM
Even if so it must have been long ago cause I don't remember doing that 🙂
2 Views