Below are my dependencies
implementation \'com.google.android.material:material:1.0.0\'
implementation \'androidx.appcompat:appcompat:1.0.2\'
implementation
We have change Gradle dependencies and style code my case working fine
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:activatedBackgroundIndicator">@drawable/drawer_list_selector</item>
<item name="android:textColorSecondary">@color/black_overlay</item>
<!--<item name="android:windowBackground">@drawable/nav_menu_background</item>-->
</style>
Gradle Dependencies
implementation 'com.google.android.material:material:1.1.0-alpha06'
Extend your base app Theme from Material Components Bridge theme. It extends AppCompat theme, but add all necessary stuff.
<style name="Theme.MyApp" parent="Theme.MaterialComponents.Light.Bridge">
<!-- ... -->
</style>
Both
Theme.MaterialComponents
andTheme.MaterialComponents.Light
have.Bridge
themes:
Theme.MaterialComponents.Bridge
Theme.MaterialComponents.Light.Bridge
Theme.MaterialComponents.NoActionBar.Bridge
Theme.MaterialComponents.Light.NoActionBar.Bridge
Theme.MaterialComponents.Light.DarkActionBar.Bridge
If allows you to keep using latest version of the library, but avoid a lot of UI issues, caused by migration to pure Material Component theme
https://material.io/develop/android/docs/getting-started/#bridge-themes
None of these worked for me. Must do these two things.
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme -->
</style>
and
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
app:theme="@style/Theme.MaterialComponents"
There is some issue with material:1.1.0-alpha01
A simple solution is to change the parent theme
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
Hope this helps someone else
|> 1: Define the following style in style.xml
:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme -->
</style>
|> 2: In the manifest.xml
file, use from above style:
<application
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme"> <!-- IMPORTANT (This was my mistake) -->
</application>
|> 3: Choose a style for your component:
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottomBar"
style="@style/Widget.MaterialComponents.BottomAppBar"
...
>
</com.google.android.material.bottomappbar.BottomAppBar>