Neal Sanche
01/29/2021, 7:36 PMBottomNavigation
with a height that also includes the navigation bar height, so that the BottomNavigation
paints all the way to the bottom of the screen. I have tried all sorts of things, and just end up with a space underneath the bottom nav. I sort of want this effect without having to resort to making a column with a spacer at the bottom. Here's the code I have so far within my Scaffold
bottomBar = {
Column(Modifier.background(MaterialTheme.colors.primary)) {
BottomNavigation(
elevation = 0.dp,
backgroundColor = MaterialTheme.colors.primary,
contentColor = contentColorFor(MaterialTheme.colors.primary),
) {
bottomNavItems.forEach { screen ->
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute =
navBackStackEntry?.arguments?.getString(KEY_ROUTE)
?: Screen.Profile.route
BottomNavigationItem(
icon = { Icon(imageVector = screen.icon, contentDescription = null) },
label = { Text(stringResource(screen.resourceId)) },
selected = currentRoute == screen.route,
onClick = {
navController.navigate(screen.route) {
popUpTo = navController.graph.startDestination
launchSingleTop = true
}
}
)
}
}
Spacer(Modifier.navigationBarsHeight())
}
}
cb
01/29/2021, 7:57 PMBottomNavigation
and TopAppBar
and friends don’t allow setting of inner content padding to achieve what you want. Have a look at the sample for an idea of how to support this: https://github.com/chrisbanes/accompanist/blob/main/sample/src/main/java/dev/chrisbanes/accompanist/sample/insets/EdgeToEdgeLazyColumn.kt#L145Neal Sanche
01/29/2021, 8:20 PM