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.

Add a LazyGrid to a composable screen

Add a LazyGrid to a composable screen - Kotlin Tutorial

From the course: Android Compose with Kotlin

Add a LazyGrid to a composable screen

- [Instructor] For our sample app, we want to dynamically display the list of sessions that we receive from our API. If you take a look at the mock up, it contains two chips up top, which allow users to filter sessions by day. Next, there are cards that contain the information for a given session, laid out in a scrolling list. To accomplish this UI design, we're going to introduce a lazy vertical grid to the session screen. To get started, instead of using a column, we're going to change this to lazy vertical grid. Next, we won't need this additional padding, so I'll simply remove it as well as this reference to the vertical arrangement. Instead, we want to specify the number of columns that we need for our grid. In this case, since we're only going to have one scrolling list, we can use grid sales fixed, and we'll set the count equal to one. The next step is to use the items extension function, which will allow us to iterate over our list of objects. So here on line number 35…

Contents