Does this work as intended or is it a bug?
I expect the images to be drawn next to each other (horizontally) (due to the equal weights), but they are drawn below each other.
Opened an Issue
as a workaround, you can place the Image in a Box and use
matchParentSize()
on the image
l
Louis Pullen-Freilich [G]
12/24/2024, 3:12 PM
Is this image a bitmap? Could you share the image you are testing with? It’s possible it is related to the intrinsic size of the image
a
Alex Styl
12/25/2024, 1:34 AM
@Louis Pullen-Freilich [G] I tried with 2 different ways. 1) load it from drawable and 2) use coil asyncimage painter to load it from unsplash. same situation
https://developer.android.com/develop/ui/compose/layouts/flow#item-weights
So, weight in a flow layout basically only applies if the items end up in the same row / column. In this case, because the image (intrinsically) is much bigger, it will be placed into its own row since there isn’t space for anything else
Depending on what your intention is, there are a few ways you could express this differently (the page I linked has some guidance), but this is working as expected from the flow layout side. In this simple snippet what you described is just a Row with two weight modifiers, you don’t want any flowing behavior here at all