0

Hey guys I'm creating a Compose function that contains a Row and two buttons. I want to align those buttons in a way that the first one is on start of the screen and the second one is on the end of the border. How can I do that? Right now, I have this:

@Composable
private fun TwoButtons() {
    Row(
        modifier = Modifier
            .fillMaxWidth()
            .background(Color.Gray),
        horizontalArrangement = Arrangement.SpaceEvenly,
        verticalAlignment = Alignment.CenterVertically
    ) {
        Button(
          onClick = { }
        )  {
            Text(text = "One")
        }

        Button(
            onClick = { }
        )  {
            Text(text = "Two")
        }

    }
}

Im getting this result:

Image with two buttons on the center

leonvian
  • 4,719
  • 2
  • 26
  • 31

1 Answers1

12

Use horizontalArrangement = Arrangement.SpaceBetween

Row Horizontal Arrangement

Docs

Abhimanyu
  • 11,351
  • 7
  • 51
  • 121