0

I am trying to convert my Android application to Jetpack Compose

I have a BottomNavigationView configured with property app:itemActiveIndicatorStyle set according to this post.

This allows for the "pill shaped" background material 3 style selection indicator on the Bottom tab nav view. But I cannot find how to do this with Jetpack Compose.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Dave Leo
  • 28
  • 4

2 Answers2

1

You can use the colors attribute in the NavigationBarItem defining the indicatorColor

NavigationBar {
    items.forEachIndexed { index, item ->
        NavigationBarItem(
            icon = { Icon(Icons.Filled.Favorite, contentDescription = item) },
            label = { Text(item) },
            selected = selectedItem == index,
            onClick = { selectedItem = index },
            colors = NavigationBarItemDefaults.colors(
                indicatorColor= Green
            )
        )
    }
}

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

Put it in themes:

    <item name="colorSecondaryContainer">#D5EBFF</item>