LazyRow
A horizontally scrolling list that only composes and lays out items that are visible.
Properties
Preview
Item #1
Item #2
Item #3
Item #4
Item #5
Item #6
Item #7
Item #8
Item #9
Item #10
Item #11
Item #12
Item #13
Item #14
Item #15
Item #16
Item #17
Item #18
Item #19
Item #20
Generated Code
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@Composable
fun MyLazyRow() {
LazyRow(
modifier = Modifier.fillMaxWidth(),
contentPadding = PaddingValues(
top = 0.dp,
bottom = 0.dp,
start = 8.dp,
end = 8.dp
),
reverseLayout = false,
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
userScrollEnabled = true
) {
items(20) { index ->
Text(
text = "Item #$index",
modifier = Modifier
.padding(16.dp)
)
}
}
}