Hello! I'm new to Jetpack Compose and I've been struggling to do something kinda basic.
Is it possible to have a
Row
inside a
Surface
and specify the Row's width to be 300% of it's parent ? (the Surface) . In my row I want to have 3 Columns, those will have width 33% relative to the Row(which is 300% relative to my Surface/Phone), that means that my Columns will have the width 100% (relative to my Surface/Phone). So I will get in the end like a Carousel, a horizontal scrolling list that's overflowing the screen
I might be taking a wrong approach, so if you have any other alternatives that's even better
c
Colton Idle
04/19/2021, 6:14 PM
Seems like you want to build a "carousel"
I haven't done so yet, but from lurking around I think there's 3 main approaches?
1. Row
2. LazyRow (samples)
3. Pager from accompanist
I guess if you wanted some snapping functionality you would use the pager, but LazyRow is probably what I would use first.
I hope that one day someone creates a Carousel (like Epoxy has) because you can control how many items are on the screen, and you can do something like 1.25F so that a piece of the next item is visible. Really handy in epoxy. Not sure if compose can do that now easily.
s
Sebastian Neagrau
04/19/2021, 6:19 PM
Yeah that's something I was looking for. I've been trying to do it using Row and Column so far, but I couldn't get the sizing to work using things like 1F. And I do not really want to use dp or a fixed size for this one. Basically my problem is more like percentage/weight related 😞
👍 1
c
Colton Idle
04/19/2021, 6:49 PM
🤞 someone else will chime in. Sorry I couldn't help!