I wanted to limit the items to 3 in lazycolumn in the below code,
@Composable
fun MessageList(messages: List<Message>) {
LazyColumn {
items(
items = messages,
key = { message ->
// Return a stable unique key for the item
message.id
}
) { message ->
MessageRow(message)
}
}
}
CodePudding user response:
If you just want 3 items, then replace
items = messages
with
items = messages.take(3)