material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.34k stars 3.06k forks source link

[BottomNavigationView ] InflateException when using Widget.Material3.BottomNavigationView style #4239

Closed a914-gowtham closed 3 months ago

a914-gowtham commented 3 months ago

Description: I'm updating my material theme version from 1.6.0 -> 1.12.0

Getting blank screen with InflateException. in the style attribute i'm using my_style that extends Widget.Material3.BottomNavigationView

main_activity.xml
<com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_nav"
        style="@style/my_style"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:labelVisibilityMode="labeled"
        app:menu="@menu/menu_custom_bottom_nav" />
   styles.xml
<style name="my_style" parent="Widget.Material3.BottomNavigationView">
        <item name="itemPaddingBottom">10dp</item>
        <item name="badgeRadius">18dp</item>
    </style>
   <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/nav_item_1"
        android:icon="@drawable/ic_call"
        android:title="Calls" />
</menu>

If i remove this style="@style/my_style", the Material 2 bottom navigation shows. but, i want to stick with Material3 BottomNavigationView

Expected behavior: to show Material3 BottomNavigationView while using material version 1.12.0. Source code: added above.

Android API version:
minSdkVersion 22 compileSdk 34 targetSdkVersion 33

Material Library version: material_version = '1.12.0' Device: Pixel 6a

a914-gowtham commented 3 months ago

working after updating the app theme to material theme