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

MarkRS

09/27/2023, 2:17 PM
I want two composables in a space, one of fixed size and the other taking all the remaining space. I think I can do that, except I want the fixed size element to be at the bottom. How do I do that? I have a nasty feeling it's simple, but I haven't been able to work it out: 😕
m

Mihai Batista

09/27/2023, 2:24 PM
You can have two composables in a column, with the first composable having
weight(1f)
to take the available space and push the second one to the bottom. ex:
Copy code
Column(
        modifier = Modifier.fillMaxSize()
    ) {
        Box(modifier = Modifier.weight(1f))

        Box(
            modifier = Modifier
                .fillMaxWidth()
                .height(60.dp)
        )
    }
m

MarkRS

09/27/2023, 2:28 PM
Ah, the "weight" thing. I saw that as a related issue, but I didn't (and still don't) understand how that works. But, it does work. Thank you @Mihai Batista .
👍 1
p

Pablichjenkov

09/27/2023, 2:40 PM
Weight or a custom
Layout {}
I just recently realized how powerful is the
Layout
Composable. You can do so many things