0

I have a NavigationBar in Scaffold, but its color elevation is 1.dp or 2.dp, but not 3.dp.

            Scaffold(
                content = { padding ->
                    Box(modifier = Modifier.padding(bottom = padding.calculateBottomPadding())) {
                        CurrentTab()
                    }
                },
                bottomBar = {

                    NavigationBar(
                        containerColor = MaterialTheme.colorScheme.surface,
                        contentColor = MaterialTheme.colorScheme.secondaryContainer,
                        tonalElevation = 1.dp,
                    ) {
                        navigationTabs.forEach {
                            TabNavigationItem(it)
                        }
                    }
                },
            )

Defaut elevation is 3.dp, and elevation of android system navigationBar color is 3.dp by default too.

Screen

Now i try to change elevation of color, but navigationBar still have 3.dp elevation by default. I want to set android system navigationBar 1.dp elevation too.

I can change color of system navBar on top composable ofc, but this bar is transparent and other screens uses this.

What is the best way to solve this?

mitua1221
  • 473
  • 3
  • 6
  • The default elevation of the NavigationBar in M3 is Level 2. It is not clear your issue. Your code works and the elevation changes. What version of M3 are you using? – Gabriele Mariotti Feb 10 '23 at 08:21
  • Default elevation in compose M3 is 3.dp `internal object NavigationBarTokens { val ContainerElevation = ElevationTokens.Level2 }` `internal object ElevationTokens { val Level0 = 0.0.dp val Level1 = 1.0.dp val Level2 = 3.0.dp val Level3 = 6.0.dp val Level4 = 8.0.dp val Level5 = 12.0.dp }` im using 'implementation "androidx.compose.material3:material3:1.1.0-alpha03"' My problem is about default elevation for android system navbar. Look, it has a 3.dp elevation, i need it 1.dp elevation too. How i can to do it? – mitua1221 Feb 10 '23 at 10:20

0 Answers0