InflateException when using TextInputLayout
Faced this issue when implementing AndroidX in my existing project.
implementation 'com.google.android.material:material:1.0.0-beta01'
Layout XML
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/userNameWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/TextLabel">
Old Style
<style name="TextLabel" parent="TextAppearance.AppCompat">
<item name="android:textColorHint">@color/hint_color</item>
<item name="android:textSize">@dimen/text_20sp</item>
<item name="colorControlNormal">@color/primaryGray</item>
<item name="colorControlActivated">@color/colorPrimary</item>
</style>
New Style
<style name="TextLabel" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="android:textColorHint">@color/hint_color</item>
<item name="android:textSize">@dimen/text_20sp</item>
<item name="colorControlNormal">@color/primaryGray</item>
<item name="colorControlActivated">@color/colorPrimary</item>
</style>
Update your themes in @style folder by inheriting one of the followings:
Theme.MaterialComponents
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.DarkActionBar
like this:
<style name="AppTheme.NoActionBar" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimaryCustom</item>
<item name="colorPrimaryDark">@color/colorPrimaryDarkCustom</item>
<item name="colorAccent">@color/colorAccentCustom</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>