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

Lilly

03/09/2021, 1:37 PM
I have made a slidable composable whicht sits under the top app bar but unfortunately the composable does not slide under the top app bar but instead over it. Here the code:
Copy code
Scaffold(
    topBar = {
		Column {
			TopAppBar(
				...
			)
			AnimatedVisibility(
				visible = (connectionState == BluetoothConnectionState.Disconnected),
				enter = slideInVertically(),
				exit = slideOutVertically(targetOffsetY = { value -> -value }),
				content = { ConnectionStatusBannerComponent(onAction = { }) }
			)
		}
	},
)
Does someone have an idea?
f

Filip Wiesner

03/09/2021, 1:40 PM
Try
Modifier.zIndex()
Creates a modifier that controls the drawing order for the children of the same layout parent. A child with larger zIndex will be drawn on top of all the children with smaller zIndex. When children have the same zIndex the original order in which the parent placed the children is used.
j

jaqxues

03/09/2021, 1:59 PM
I would suggest you use a Scaffold for the TopAppBar/contents
l

Lilly

03/09/2021, 2:02 PM
@jaqxues of course I do, just left it out in my snippet 🙂
Edited my snippet
@Filip Wiesner Thanks, works like a charm
🙌 2