InflateException with TextInputLayout and AlertDialog

customize textinputlayout android
textinputlayout error
textinputlayout error color
textinputlayout androidx
textinputlayout error icon
android-textinputlayout style
android textinputlayout clear button
error inflating textinputedittext

I am trying to use the newest TextInputLayout in my DialogFragment.

Here's my code:

<android.support.design.widget.TextInputLayout
    android:id="@+id/testingInputLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

   <EditText
       android:id="@+id/testingEditText"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:hint="@string/testText"
       android:inputType="textEmailAddress" />

</android.support.design.widget.TextInputLayout>

Some background info:

  • The activity that launches the DialogFragment derives from AppCompatActivity
  • The DialogFragment derives from Android.Support.V4.App.DialogFragment
  • I build the DialogFragment via the Android.Support.V7.App.AlertDialog.Builder
  • The DialogFragment is launched via a SupportFragmentManager
  • I am using the latest Support Design Library

Here's the error (I'm using Xamarin, hence the MonoDroid)

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Android.Views.InflateException: Exception of type 'Android.Views.InflateException' was thrown.
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x00078>
[MonoDroid] at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue*) [0x00064] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:195
[MonoDroid] at Android.Views.LayoutInflater.Inflate (int,Android.Views.ViewGroup) [0x0006d] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.LayoutInflater.cs:646
[MonoDroid] at HelloLittleApp.MyOwnDialog.OnCreateDialog (Android.OS.Bundle) [0x00027] in e:\Progetti\HelloLittleApp-Android\Dialogs\MyOwnDialog.cs:22
[MonoDroid] at Android.Support.V4.App.DialogFragment.n_OnCreateDialog_Landroid_os_Bundle_ (intptr,intptr,intptr) <IL 0x00013, 0x000f7>
[MonoDroid] at (wrapper dynamic-method) object.e260d9fd-b921-4418-a47a-496934404e0e (intptr,intptr,intptr) <IL 0x00017, 0x0004b>
[MonoDroid]   --- End of managed exception stack trace ---
[MonoDroid] android.view.InflateException: Binary XML file line #1: Error inflating class android.support.design.widget.TextInputLayout
[MonoDroid]     at android.view.LayoutInflater.createView(LayoutInflater.java:633)
[MonoDroid]     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
[MonoDroid]     at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
[MonoDroid]     at md5a2b8d0e6e3890b714223a2b1204f749c.MyOwnDialog.n_onCreateDialog(Native Method)
[MonoDroid]     at md5a2b8d0e6e3890b714223a2b1204f749c.MyOwnDialog.onCreateDialog(MyOwnDialog.java:29)
[MonoDroid]     at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:308)
[MonoDroid]     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)
[MonoDroid]     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
[MonoDroid]     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
[MonoDroid]     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
[MonoDroid]     at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:458)
[MonoDroid]     at android.os.Handler.handleCallback(Handler.java:739)
[MonoDroid]     at android.os.Handler.dispatchMessage(Handler.java:95)
[MonoDroid]     at android.os.Looper.loop(Looper.java:135)
[MonoDroid]     at android.app.ActivityThread.main(ActivityThread.java:5254)
[MonoDroid]     at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid]     at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid]     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[MonoDroid]     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[MonoDroid] Caused by: java.lang.reflect.InvocationTargetException
[MonoDroid]     at java.lang.reflect.Constructor.newInstance(Native Method)
[MonoDroid]     at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
[MonoDroid]     at android.view.LayoutInflater.createView(LayoutInflater.java:607)
[MonoDroid]     ... 21 more
[MonoDroid] Caused by: java.lang.RuntimeException: Failed to resolve attribute at index 18
[MonoDroid]     at android.content.res.TypedArray.getColor(TypedArray.java:401)
[MonoDroid]     at android.support.design.widget.CollapsingTextHelper.setCollapsedTextAppearance(CollapsingTextHelper.java:166)
[MonoDroid]     at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:106)
[MonoDroid]     ... 24 more
[AndroidRuntime] Shutting down VM

Any tip is appreciated.


I had similar error:

android.view.InflateException: Binary XML file line #1: Error inflating class android.support.design.widget.TextInputLayout

Trying to reproduce it for a new project I found that the problem for me was in App Theme! Try to set android:theme field in application tag of Android Manifest like this:

 <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat">

android, I had similar error: android.view.InflateException: Binary XML file line #1: Error inflating class android.support.design.widget.TextInputLayout. Trying to  I am facing the issue in textInputLayout Password field Resource not found exception Drawable drawable/design_password_eye with resource ID #0x7f080098 Please help me to solve this .


This happened to me as well, and I came up with a solution inspired by AHTOH's. It requires simply changing the Theme of the TextInputLayout:

<android.support.design.widget.TextInputLayout
    android:id="@+id/testingInputLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/Theme.AppCompat">

   <EditText
       android:id="@+id/testingEditText"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:hint="@string/testText"
       android:inputType="textEmailAddress" />

</android.support.design.widget.TextInputLayout>

You will need to add the appCompat library if you have not already:

compile 'com.android.support:appcompat-v7:23.0.1'

InflateException with TextInputLayout and AlertDialog, I am trying to use the newest TextInputLayout in my DialogFragment. Here's my code: <android.support.design.widget.TextInputLayout  Browse other questions tagged android kotlin android-alertdialog android-textinputlayout android-textinputedittext or ask your own question. The Overflow Blog Podcast 241: New tools for new times


android, Я имел подобную ошибку: android.view.InflateException: Binary XML file line #1​: Error inflating class android.support.design.widget.TextInputLayout. Пытаясь  TL/DR: An exception occurred during the creation of a fragment referenced from a higher-level layout XML. This exception caused the higher-level layout inflation to fail, but the initial exception was not reported; only the higher-level inflation failure shows up in the stack trace.


Even though the Theme is set properly in the manifest, this might happen depending on the Context you are inflating from. You can fix this by using a ContextWrapper with your AppTheme (or another one) when initialising the LayouInflater:

LayoutInflater inflater = LayoutInflater.from(new ContextThemeWrapper(getApplicationContext(), R.style.AppTheme));
View view = inflater.inflate(R.layout.your_dialog_layout, null);

InflateException с TextInputLayout и AlertDialog – 7 Ответов, У меня была схожая ошибка: android.view.InflateException: Binary XML file line #1: Error inflating Вопрос по теме: android, xamarin.android. Prompt User Input with an AlertDialog 9 votes · 21 comments This code creates an input-dialog with AlertDialog.Builder where a user can enter text in an EditText field and press on "Ok" and "Cancel".


i had the android.view.InflateException: Binary XML file line #1: Error inflating class android.support.design.widget.TextInputLayout error too. It turned out to be caused by my proguard/gradle config . I was using the shrinkResources directive in my release build config.

After i removed the shrinkResources directive from my release build config everything started working again.

Hope it helps someone.

InflateException з TextInputLayout і AlertDialog, Гэта здарылася са мной, як добра, і я прыдумаў рашэнне натхнёны AHTOH ст. Яна патрабуе простага змены Тэмы TextInputLayout: · Вам трэба будзе  And above the class <android.support.design.widget.TextInputLayout and <android.support.design.widget.TextInputEditText has been changed to com.google.android.material.textfield.TextInputLayout and com.google.android.material.textfield.TextInputEditText. Have a look at this link to get a better idea of what all support libraries got refractored.


InflateException TextInputLayout және AlertDialog көмегімен, Бұл менімен де болды және мен AHTOH -тен шыққан шешіммен келдім. Тек TextInputLayout тақырыбын өзгерту қажет: Егер сізде қазір жоқ болса,  AlertDialog with a custom layout. Sometimes the standard AlertDialogs just don’t meet your needs. It’s not difficult to create a custom alert, though. This post will show you a minimal example.


android.view.InflateException: Binary XML file line #0: Error inflating , InflateException: Binary XML file line #0: Error inflating class android.widget.​EditText #417. Open. iad24 opened this issue on Oct 12, 2017 · 48 comments. Open  InflateException con TextInputLayout y AlertDialog. Estoy intentando utilizar el TextInputLayout más nuevo en mi DialogFragment.. Aquí está mi código: Circular ImageView en Xamarin


TextInputLayout, Layout which wraps a TextInputEditText , EditText , or descendant to show a floating label when the hint is hidden while the user inputs text.