From the course: Android Compose with Kotlin

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Display UI elements with Column, Row, and Box

Display UI elements with Column, Row, and Box - Kotlin Tutorial

From the course: Android Compose with Kotlin

Display UI elements with Column, Row, and Box

- [Instructor] Composables are functions that specify some UI element in your app. In this example, we have a composable function that shows a greeting to the user. Inside of our greeting function, we have three other composables. One is column on line number 15. This is a layout composable, and it's responsible for laying out its children vertically, similar to a linear layout. Then we have two text composable inside of it that display visible text to the user. It's pretty simple so far, right? We can use our preview to see how these composable will appear on screen. The text elements appear one after the other in the order in which they were defined. Layout composables like column allow you to customize how the children are arranged. So let's add a new parameter to the column composable. We'll come here to line number 15, and this will be inside of the parentheses. We're going to add a new parameter, and that's going to be horizontal alignment. Okay, perfect. And we're going to set…

Contents