https://kotlinlang.org logo
#compose
Title
# compose
s

Siyamed

04/01/2020, 8:53 PM
it is strange. afaik nothing in text changed to cause a rendering problem. sounds like draw related.not sure where
s

semoro

04/01/2020, 8:53 PM
Maybe some problems with positioning?
Aha, got it
Copy code
Column {
 Text("Sample")
 Surface(elevation=1.dp) {}
}
Seems that it is related to elevation somehow
Yeah, got another broken screen:
Copy code
@Composable
fun CActivity() {
    Column {
        Text("Sample")
        Button(onClick = {}) {
            Text("Renders properly")
        }
    }
}
Same for
Row
It looks like space is reserved for that text, but text itself doesn’t render
Works:
Copy code
Box {
 Box(Modifier.drawLayer(elevation = 1f))
 Text("Sample", Modifier.drawLayer())
}
Didn’t work
Copy code
Box {
 Box(Modifier.drawLayer(elevation = 1f))
 Text("Sample")
}
s

Siyamed

04/01/2020, 9:21 PM
I called for help 🙂
👍 1
cc @George Mount @Nader Jawad
n

Nader Jawad

04/01/2020, 9:50 PM
Hi Simon, Looking at your most recent example, is there a reason why the inner box doesn't have a child composable? Is the intention for the Text composable to be a child of the inner Box composable?
s

semoro

04/01/2020, 9:51 PM
Nope, I’ve just used it to apply drawLayer/drawShadow to something, it can be effectively replaced by
Surface(elevation=1.dp) {}
Problem occures when there is a Text on same nesting level with something that have elevation
a

Andrey Kulikov

04/01/2020, 10:41 PM
yes, unfortunately it is an issue we fixed only after cutting this release as part of this commit: https://android-review.googlesource.com/c/platform/frameworks/support/+/1272904
we reordered drawing so items with lower elevation will be drawn before items with the larger ones and it caused some drawing issues. this will be fixed in dev09. for now you have to use the same elevation for such items or stick to the previous release. I didn't try but as a temporary workaround you can also try: instead of Surface(elevation=1.dp) you can write Surface(Modifier.drawLayer(), elevation=1.dp) it could help here (disable reordering as we introduced another layer with 0 elevation)
s

semoro

04/01/2020, 10:47 PM
Cool! Thank you for workaround