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

Ayfri

04/19/2022, 4:24 PM
Hi, how can I set a Column element to have a maximum width as a fraction ? (like
fillMaxWidth()
but I only want to limit the maximum size)
c

Csaba Szugyiczki

04/19/2022, 4:28 PM
Add a
Row
and inside the Row you can have a
Modifier.weight(0.5f)
where you can specify the fraction of the width you want your Composable to take
the Row might need a Modifier.fillMaxWidth() to work properly
a

Ayfri

04/19/2022, 5:44 PM
Thanks !
👍 1
j

Jan Bína

04/19/2022, 8:19 PM
Modifier.fillMaxWidth()
itself has a
fraction
argument, so you can use that directly on your element, no need to wrap it in a
Row
a

Ayfri

04/19/2022, 8:20 PM
It's not what I want, as I just want to limit the maximum width, not the minimal width
j

Jan Bína

04/19/2022, 8:22 PM
oh, i see
12 Views