I have a LazyList with some values:
LazyColumn(
modifier = modifier
.padding(start = 20.dp, end = 20.dp)
.clip(RoundedCornerShape(10.dp))
.background(color = Color.Red),
state = listState,
contentPadding = PaddingValues(top = 15.dp, bottom = 40.dp)
) {
items(collectionListState.value) { collection ->
CollectionListItem(
collectionName = collection,
navigateToCollection = { navController.navigate("DcodeList/${collection}") }
)
if (collectionListState.value.indexOf(collection) < collectionListState.value.lastIndex) {
Divider(
modifier = Modifier
.padding(
start = 6.dp,
end = 6.dp,
top = 2.dp,
bottom = 2.dp
),
thickness = 2.dp
)
}
}
}
I want to set the background to only my items WITHOUT the contentPadding. It looks awful.
Is it possible for me to apply the background to items only ?
Or is there some other option for me to achieve the same result without contentPadding ?
Not the most important thing in the world but it would just look nicer.
I saw theres a Modifier.clipToBounds but Im either not competent enough to use it the right way or it has a different purpose.
Michal Rymarski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.