Jetpack Compose Arrangement: A Visual Guide
One of my favorite blog posts is Amanda Hill’s Android ImageView ScaleType: A Visual Guide. For some reason, I can never remember Android’s different image scaling modes and a visual reference guide really works for me.
This post takes inspiration from Amanda and does the same thing but for Jetpack Compose’s Arrangement property.1
↔️ Row
SpaceEvenly
SpaceBetween
SpaceAround
↕️ Column
SpaceEvenly |
SpaceBetween |
SpaceAround |
---|---|---|
![]() |
![]() |
![]() |
Descriptions
SpaceEvenly
Place children such that they are spaced evenly across the main axis, including free space before the first child and after the last child. Visually: #1#2#3# for LTR and #3#2#1# for RTL.
SpaceBetween
Place children such that they are spaced evenly across the main axis, without free space before the first child or after the last child. Visually: 1##2##3 for LTR or 3##2##1 for RTL.
SpaceAround
Place children such that they are spaced evenly across the main axis, including free space before the first child and after the last child, but half the amount of space existing otherwise between two consecutive children. Visually: #1##2##3# for LTR and #3##2##1# for RTL
-
For now, this post excludes the arrangements
Top
/Bottom
,Start
/End
, andCenter
because I deem those are relatively straight forward to internally visualize. 😀 ↩︎