16

I follow the official document to learn about Rows.

It's working fine. It arrange views horizontally and application runs without any issues.

Problem:

I want to set horizontalArrangement in Row. It didn't arrange it.

My code:

@Composable fun SimpleRowArrangement(){ Row(horizontalArrangement = Arrangement.SpaceEvenly, verticalAlignment = Alignment.Bottom) { Text(text = "Row Text 1") Text(text = "Row Text 2") Text(text = "Row Text 3") } } 

Output: enter image description here

1
  • 1
    Apply also the fillMaxWidth modifier Commented Aug 5, 2021 at 11:52

1 Answer 1

46

You should apply also the fillMaxWidth modifier.

Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceEvenly, verticalAlignment = Alignment.Bottom ) { Text(text = "Row Text 1") Text(text = "Row Text 2") Text(text = "Row Text 3") } 

enter image description here

Sign up to request clarification or add additional context in comments.

5 Comments

working fine. In documentation they didn't mention anything. Thanks for your answer
And if I want one Text at the start, one Text at the end of Row(Modifier.fillMaxWidth) So, how to achieve it ?
@MichaelAbyzov You can use Arrangement.SpaceBetween. Check also stackoverflow.com/a/64433116/2016562
VerticalAlignment doesn't compile.
@IgorGanapolsky the verticalAlignment attribute exists. check also the doc

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.