以下是我的代码:
<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>
一些背景信息:
- 启动DialogFragment的活动派生自AppCompatActivity
- DialogFragment派生自Android.Support.V4.App.DialogFragment
- 我通过Android.Support.V7.App.AlertDialog.Builder构建DialogFragment
- DialogFragment通过SupportFragmentManager启动
- 我正在使用最新的Support Design Library
以下是错误信息(我正在使用Xamarin,因此出现了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
感激不尽,欢迎提供任何建议。
@style/Theme.AppCompat
还是@style/android:Theme.Material
? - SolaceTheme.AppCompat.Light.NoActionBar
,但在“values-c21”样式文件中,我发现资源标签以<resources>>
开始,而不是<resources>
,这会导致此错误的原因吗:Caused by android.content.res.Resources$NotFoundException: File res/drawable-v21/design_password_eye.xml from drawable resource ID
? - Edijae Crusar