fun NormalColumn(modifier: Modifier = Modifier) { Column { repeat(100) { Text(text = "Unit 1: Your first Android app (3 Badges)") Text(text = "Unit 2: Building app UI (3 Badges)") Text(text = "Unit 3: Display lists and use Material Design (3 Badges)") } } } Display collections with Column Column is use to place items vertically on the screen.
default, Column is not scrollable, we need to use The verticalScroll and horizontalScroll modifiers provide the simplest way to allow the user to scroll an element How do we make the Column scrollable? Column( modifier = Modifier .verticalScroll(rememberScrollState()) )
fun NormalRow(modifier: Modifier = Modifier) { Row(modifier = Modifier .horizontalScroll(rememberScrollState()) { repeat(100) { Text(text = "Unit 1,") Text(text = "Unit 2,") Text(text = "Unit 3,") } } } Display collections with Row Similarly, use Row to place items horizontally on the screen. Both Column and Row support configuring the alignment of the elements they contain.
we should use Lazy? The content for each item in the Lazy lists/grids is provided using a lambda function that maps each item to a Composable function. This allows you to define the content and appearance of each item based on its data. By rendering only the visible items, Lazy lists/grids helps in managing memory efficiently, especially for large lists where rendering all items at once would be impractical. Loads and composes only the visible items on the screen, optimizing performance and memory usage. As the user scrolls, it dynamically composes and displays new items and recycles those that are no longer visible. Lazy Loading Efficient Memory Usage Item Composition