jordond
07/19/2023, 1:33 AMConstraintLayout
for non-android targets. I’m still learning Compose, and I’m a little stuck in my old XML ways and very used to ConstraintLayout.
How would I go about making something similar in Compose?
Specifically, lets say I have a Column
that has Modifier.fillMaxSize()
. And I wanted to add a title Text
composable a third of the way down from the top. Surely I could use padding, but that wouldn’t always be a third of the way down.
I’m sure it can be done using Box
, I’m just not familiar with it. Any tips, or links to this type of stuff? I don’t really know what to call it. In ConstraintLayout you would use a Guideline
set to 0.3f
.james
07/19/2023, 1:37 AMText
composable is the first one in the column then you can just use a spacer, something like this:
Column(modifier = Modifier.fillMaxWidth()) {
Spacer(modifier = Modifier.fillMaxHeight(0.3f)) // spacer fills 30% of available height
Text(...)
}
ephemient
07/19/2023, 2:15 AM