Bjarne Gelotte
09/26/2021, 9:13 AMelevation
works in Compose. If two Surfaces
with the same elevation
are directly adjacent, they still cast a shadow on each other. How come? Is it possible to avoid this somehow? I would be super grateful for some guidance! Example and code in thread.Bjarne Gelotte
09/26/2021, 9:14 AMLazyColumn
, to appear as a single card. I don't want the thin shadow line between each item.Bjarne Gelotte
09/26/2021, 9:14 AM@Composable
private fun List() {
Surface(
modifier = Modifier.fillMaxWidth(),
color = Color.White
) {
LazyColumn(modifier = Modifier.fillMaxSize()) {
item { Spacer(modifier = Modifier.padding(4.dp)) }
item { ListItem(text = "Item 1") }
item { ListItem(text = "Item 2") }
item { ListItem(text = "Item 3") }
}
}
}
@Composable
private fun ListItem(text: String) {
Surface(
modifier = Modifier
.fillMaxWidth()
.padding(start = 8.dp, end = 8.dp),
color = Color.White,
elevation = 2.dp
) {
Text(
modifier = Modifier.padding(4.dp),
text = text
)
}
}
Nabeel
09/26/2021, 11:28 AMBjarne Gelotte
09/26/2021, 12:48 PMText
) to the LazyColumn
, above the card, with no elevation? Then that approach doesn't work, right?alorma
09/26/2021, 2:34 PMModifier.zIndex(1f)
to the adjacent composablesBjarne Gelotte
09/26/2021, 2:53 PMzIndex(1f)
to the list items, unfortunately the result is unchangedZach Klippenstein (he/him) [MOD]
09/27/2021, 3:14 PMBut what if I want to add a header (Sure it does, in the example you posted. But in that example, it doesn’t make sense to use a lazy column in the first place because there are so few items in the group. Does your real code have a lot more items per card group?) to theText
, above the card, with no elevation? Then that approach doesn’t work, right?LazyColumn
Bjarne Gelotte
09/27/2021, 3:26 PMLazyColumn
).Bjarne Gelotte
10/04/2021, 8:16 AMLazyColumn
: https://issuetracker.google.com/issues/170472398. I have tried to work around it but haven't managed to find a solution.