Search code examples
androidbottomnavigationviewandroid-jetpack-compose-material3

How to use BottomNavigationView material3 design


I'm using BottomNavigationView

<com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/bottomNavigationView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                app:menu="@menu/bottom_nav_menu" />

//build.gradele
implementation "androidx.compose.material:material-icons-extended:1.5.0"
implementation 'androidx.compose.material:material:1.5.0'

but design as from Material2?


Solution

  • Both designs are using same view implementation, you just have to apply some material3 theme to it, e.g.

    <com.google.android.material.bottomnavigation.BottomNavigationView
                    android:id="@+id/bottomNavigationView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    app:menu="@menu/bottom_nav_menu"
                    android:theme="@style/Theme.Material3.DayNight"/>