Home > Blockchain >  How to custom left/right align items in android jetpack compose Row
How to custom left/right align items in android jetpack compose Row

Time:04-03

I want a Row in Jetpack Compose, something like this:

----------------------------------------------------
| A |   B   |                                  | C |
----------------------------------------------------

I want A & B to be left aligned, next to each other and C at the end. I don't know if the existing horizontal arrangement has ways to do this. Also I think, nesting Rows may not be a good idea. What's the best way to achieve this?

CodePudding user response:

You can use Spacer with Modifier.weight:

Row {
    Text("a")
    Text("b")
    Spacer(Modifier.weight(1f))
    Text("c")
}
  • Related