0
0
Android Kotlinmobile~5 mins

LazyRow for horizontal lists in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is LazyRow in Jetpack Compose?
LazyRow is a composable that displays a horizontally scrolling list. It only composes and lays out visible items, improving performance for long lists.
Click to reveal answer
beginner
How do you add spacing between items in a LazyRow?
You can add spacing by using the horizontalArrangement parameter with Arrangement.spacedBy(dp) to set space between items.
Click to reveal answer
intermediate
Why use LazyRow instead of Row for horizontal lists?
LazyRow only creates items that are visible on screen, saving memory and CPU. Row creates all items at once, which can be slow and use more memory for large lists.
Click to reveal answer
beginner
How do you handle item clicks inside a LazyRow?
You wrap each item in a clickable modifier like Modifier.clickable { /* handle click */ } to respond to user taps.
Click to reveal answer
beginner
What parameter do you use to provide the list of items to LazyRow?
You use the items function inside LazyRow's content block to pass a list and define how each item looks.
Click to reveal answer
What does LazyRow do in Jetpack Compose?
ADisplays a horizontally scrolling list with lazy loading
BDisplays a vertical list of items
CCreates all items at once in a horizontal layout
DIs used for navigation between screens
How can you add space between items in a LazyRow?
AUse verticalArrangement = Arrangement.spacedBy(dp)
BUse padding inside each item only
CUse horizontalArrangement = Arrangement.spacedBy(dp)
DUse Modifier.fillMaxWidth()
Which modifier allows an item in LazyRow to respond to taps?
AModifier.clickable()
BModifier.background()
CModifier.fillMaxSize()
DModifier.padding()
Why is LazyRow preferred over Row for long horizontal lists?
ARow supports lazy loading
BLazyRow creates all items at once
CLazyRow scrolls vertically
DLazyRow only composes visible items, improving performance
How do you provide data items to LazyRow?
APassing a list to LazyColumn
BUsing the items() function inside LazyRow
CUsing a for loop inside Row
DUsing setContentView()
Explain how LazyRow improves performance compared to a regular Row when displaying many items horizontally.
Think about how many items are created and drawn on screen.
You got /4 concepts.
    Describe how you would add clickable behavior and spacing between items in a LazyRow.
    Consider modifiers and LazyRow parameters.
    You got /4 concepts.