Cheatsheet for centering items in Jetpack Compose

PressRex profile image
by PressRex
Cheatsheet for centering items in Jetpack Compose

Blog InfosAuthorSherry YuanPublished30. January 2025Topicsandroid, Android App Development, AndroidDev, Jetpack Compose, KotlinAuthorSherry YuanPublished30. January 2025Topicsandroid, Android App Development, AndroidDev, Jetpack Compose, KotlinFacebookTwitter

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

Mastering Kotlin Coroutine Channels in Android: From Basics to Advanced Patterns

APPLY NOW

Cheatsheet for centering items in Jetpack Compose

APPLY NOW

Cracking the Interview: Networking Essentials for Android Engineers

APPLY NOW

Job Offers

There are currently no vacancies.

OUR VIDEO RECOMMENDATION

Compose, droidcon San Francisco, Kotlin

Kobweb:Creating websites in Kotlin leveraging Compose HTML

droidconKobweb is a Kotlin web framework that aims to make web development enjoyable by building on top of Compose HTML and drawing inspiration from Jetpack Compose.Watch Video

Kobweb:Creating websites in Kotlin leveraging Compose HTML

David HermanEx-Googler, author of Kobweb

Kobweb:Creating websites in Kotlin leveraging Compose HTML

David HermanEx-Googler, author o ...

Kobweb:Creating websites in Kotlin leveraging Compose HTML

David HermanEx-Googler, author of Kob ...

Jobs

No results found.

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.

YOU MAY BE INTERESTED IN

YOU MAY BE INTERESTED IN

blog

Swipe to Dismiss — Jetpack Compose

Pankaj RaiIt’s one of the common UX across apps to provide swipe to dismiss so…READ MORE blog

Introducing Jetpack Compose into an existing project

Ziv KestenIn this part of our series on introducing Jetpack Compose into an existing project,…READ MORE blog

Harmonizing Modifiers in Jetpack Compose: A Tale of Flexibility and Usability

Mahmoud AfaridehIn the world of Jetpack Compose, where designing reusable and customizable UI components is…READ MORE blog

Make sure to update your StateFlow safely in Kotlin!

droidconHi, today I come to you with a quick tip on how to update…READ MORE

Der Beitrag Cheatsheet for centering items in Jetpack Compose erschien zuerst auf droidcon.

Source: View source

PressRex profile image
by PressRex

Subscribe to New Posts

Lorem ultrices malesuada sapien amet pulvinar quis. Feugiat etiam ullamcorper pharetra vitae nibh enim vel.

Success! Now Check Your Email

To complete Subscribe, click the confirmation link in your inbox. If it doesn’t arrive within 3 minutes, check your spam folder.

Ok, Thanks

Read More