After three years of writing Compose code, I still find myself frequently Googling “how to center items in Row/Column/Box” because I haven’t memorized all the permutations of arrangement and alignment parameters. I finally made a visual cheat sheet for this. Hope it’s helpful for anyone else who spends too much time Googling or asking AI how to center things!
These tables are also available in my android-cheatsheet repo, where I collect visual guides for Android development.
Job Offers
A rule of thumb is that Arrangement parameters specify the placement of children in the main axis direction (eg. horizontalArrangement
for Row
and verticalArrangement
for Column
), whereas the Alignment parameters specify their placement in the cross axis direction (eg. verticalAlignment
for Row
and horizontalAlignment
for Column
)
This post isn’t intended to go into technical details, so here are some articles that do:
Happy New Year! May we all spend less time Googling “how to center items” in 2025! 🥂
This article is previously published on proandroiddev.com.