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

Marcin Wisniowski

02/08/2022, 1:03 PM
What's the relationship between
elevation
and
zIndex
? They seem to affect each other, but I am not sure how exactly.
f

Filip Wiesner

02/08/2022, 1:06 PM
elevation
in the material design refers to the theoretical elevation of the element and the resulting shadow. The
zIndex
should be purely the draw order in a scope.
From
shadow()
modifier documentation:
Note that elevation is only affecting the shadow size and doesn't change the drawing order. Use a androidx.compose.ui.zIndex modifier if you want to draw the elements with larger elevation after all the elements with a smaller one.
5 Views