Logan Knight
01/21/2021, 9:19 PMLogan Knight
01/21/2021, 9:20 PMBox(
Modifier
.fillMaxSize()
.background(Color.White)
) {
Column(
Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState())
.align(Alignment.Center)
) {
for (i in 1..15) {
Box(
Modifier
.size(96.dp)
.padding(0.dp, 16.dp)
.align(Alignment.CenterHorizontally)
.background(Color.LightGray)) {
Text(
i.toString(),
Modifier.align(Alignment.Center)
)
}
}
}
Surface(
Modifier
.align(Alignment.TopStart),
elevation = 24.dp
) {
Box(
Modifier
.fillMaxWidth()
.height(48.dp)
.background(Color.White)
)
}
Surface(
Modifier
.align(Alignment.BottomStart),
elevation = 24.dp
) {
Box(
Modifier
.fillMaxWidth()
.height(48.dp)
.background(Color.White)
)
}
Logan Knight
01/21/2021, 9:21 PMLogan Knight
01/21/2021, 9:21 PMBox(
Modifier
.fillMaxSize()
.background(Color.White)
) {
Surface(
Modifier
.align(Alignment.TopStart),
elevation = 24.dp
) {
Box(
Modifier
.fillMaxWidth()
.height(48.dp)
.background(Color.White)
)
}
Column(
Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState())
.align(Alignment.Center)
) {
for (i in 1..15) {
Box(
Modifier
.size(96.dp)
.padding(0.dp, 16.dp)
.align(Alignment.CenterHorizontally)
.background(Color.LightGray)) {
Text(
i.toString(),
Modifier.align(Alignment.Center)
)
}
}
}
Surface(
Modifier
.align(Alignment.BottomStart),
elevation = 24.dp
) {
Box(
Modifier
.fillMaxWidth()
.height(48.dp)
.background(Color.White)
)
}
Logan Knight
01/21/2021, 9:22 PMLogan Knight
01/21/2021, 9:24 PMSurface
first break the elevation
?Logan Knight
01/21/2021, 9:26 PMZach Klippenstein (he/him) [MOD]
01/21/2021, 9:38 PMLogan Knight
01/21/2021, 9:41 PMLogan Knight
01/22/2021, 11:29 AMelevation - The size of the shadow below the surface. Note that It will not affect z index of the Surface. If you want to change the drawing order you can use Modifier.zIndex.
...
Surface(
Modifier
.zIndex(2f)
.align(Alignment.TopStart),
elevation = 24.dp
)
...
works.
So now my questions now are why does the bottom bar receive a z-index derived from the elevation
param?
How am I to know what value it has relative to the other components?
Does specifying a z-index override the one derived from the elevation
param?Andrey Kulikov
01/22/2021, 1:58 PMAndrey Kulikov
01/22/2021, 1:58 PMLogan Knight
01/22/2021, 3:41 PMSurface
does seem to receive or assign a zIndex
to it's children? Or if the first Surface
is called after the Column
it seems receive or assign a zIndex
to it's children?Andrey Kulikov
01/22/2021, 4:25 PMLogan Knight
01/22/2021, 4:33 PMelevation
value of the third child (the Surface
) that had caused it to appear and behave as though it was on top of the second child (the Column
) when it is simply the order in which they were drawn. Removing the elevation
from the third child simply removes the shadow but still causes the Column
to be behind it inline with what you said. Thank you for taking the time to help with this.