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:ProgettiHelloLittleApp-AndroidDialogsMyOwnDialog.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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…