From the course: Android Compose with Kotlin

Unlock this course with a free trial

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

Solution: Bye-bye ConstraintLayout

Solution: Bye-bye ConstraintLayout - Kotlin Tutorial

From the course: Android Compose with Kotlin

Solution: Bye-bye ConstraintLayout

(upbeat music) - [Instructor] How'd it go? Were you able to recreate our challenge screen? Hopefully you had the chance to explore a few new parameters during the process. Here's the solution I came up with. First, I used the O1_07 branch as my basis. It contains the XML layout that we wanted to recreate. Then I added my solution to the solution 01_ 08 file. Let me talk you through the changes. We'll start with adding some padding to our elevated card. You may have noticed that the content was stretched all the way from edge to edge, and so to mimic the padding that we had in our XML layout, I used the padding modifier. So here on line number six, you see we have content padding of 16 dp. I mimic that over here on line number 32. Next, we wanted the items to be centered vertically. To do that, we're using the vertical alignment property of our row set to alignment center vertically. And what about that image? I set its size equal to 90.dp. The size modifier lets you set the width and…

Contents