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.

Use modifiers to customize your layout

Use modifiers to customize your layout - Kotlin Tutorial

From the course: Android Compose with Kotlin

Use modifiers to customize your layout

- [Instructor] A composable without modifiers is like a cake with no frosting. It's edible, but not that delicious. Modifiers are essential for customizing your layouts. They allow you to change the appearance of your composable, such as the size, layout, and behavior. You can process user input, like entering their name or password. Modifiers also allow you to add high-level interactions, like making an element clickable, scrollable, and more. And finally, modifiers provide a way to add custom information to a composable, like accessibility labels. Let's take a look at two composable layouts. The first makes use of modifiers, the second does not. What a difference. Here in Android Studio, we have a view-based layout file and a composable layout file. If we focus on the view-based file for a bit, we see we have a card view, and inside of it is our constraint layout. The constraint layout is used to position the children views. So inside of it we have view elements, and we've made them…

Contents