Material-components-android: [TabLayout] Error inflating class com.google.android.material.tabs.TabLayout

Created on 24 Aug 2020  路  2Comments  路  Source: material-components/material-components-android

Description: got this error

Expected behavior: view is inflated

Source code: The code snippet which is causing this issue. Please consider attaching a minimal sample app that reproduces the issue.

 <com.google.android.material.tabs.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        app:layout_constraintTop_toBottomOf="@id/header"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:tabIndicatorFullWidth="true"
        app:tabIndicatorGravity="stretch"
        app:tabMinWidth="0dp"
        app:tabMode="auto"
        app:tabPaddingEnd="4.5dp"
        app:tabPaddingStart="4.5dp"
        app:tabRippleColor="@android:color/transparent"
        app:tabSelectedTextColor="@color/white"
        app:tabTextAppearance="@style/courseTapStyle" />

Android API version: 29

Material Library version: 1.2.0

Device: Android Emulator Pixel2 XL

also appTheme is
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

bug

Most helpful comment

You should use Theme.MaterialComponents.* as app theme.

All 2 comments

You should use Theme.MaterialComponents.* as app theme.

thanks it works now @gabrielemariotti

Was this page helpful?
0 / 5 - 0 ratings