android-jetpack-compose-layout
How to make element fill the remaining space inside a Row or a Column in Jetpack Compose
You can apply the weight modifier only to the long text. The .weight modifier sizes the element’s width proportional to its weight relative to other weighted sibling elements in the Row. The parent will divide the horizontal space remaining after measuring unweighted child elements and distribute it according to this weight Something like: Row() { … Read more
Create Vertical Divider Jetpack Compose
You can use the Divider composable with the width(xx.dp) modifier applying an intrinsic measurements to its parent container. Something like: Row(Modifier .height(IntrinsicSize.Min) //intrinsic measurements .fillMaxWidth() .background(Color.Yellow) ) { Text(“First Text”) Divider( color = Color.Red, modifier = Modifier .fillMaxHeight() //fill the max height .width(1.dp) ) Text(“Second text”) } As explained in the doc: The Row composable’s … Read more
Weights in Jetpack compose
You can use the Modifier.weight Something like: Row() { Column( Modifier.weight(1f).background(Blue) ){ Text(text = “Weight = 1”, color = Color.White) } Column( Modifier.weight(2f).background(Yellow) ) { Text(text = “Weight = 2”) } }