E/AppCompatResources: Failed to inflate colorStateList,leaving it to the frameworkjava.lang.UnsupportedOperationException: Can't convert to color: type=0x2
我有一些下一个组件.
<androID.support.design.Widget.TextinputLayout androID:ID="@+ID/til_email" androID:layout_wIDth="match_parent" androID:layout_height="@dimen/textinput_height"> <androID.support.v7.Widget.AppCompatEditText androID:ID="@+ID/et_email" androID:layout_wIDth="match_parent" androID:layout_height="@dimen/textinput_height" androID:drawableleft="@drawable/ic_face" androID:drawableStart="@drawable/ic_face" androID:drawablepadding="8dp" androID:hint="@string/str_email" androID:imeOptions="actionNext" androID:inputType="textEmailAddress" androID:textcolor="@color/blue" androID:typeface="normal" /> </androID.support.design.Widget.TextinputLayout>
我不知道如何解决这个失败.有人可以告诉我一些建议吗?
谢谢.
堆栈跟踪
06-22 09:26:46.897 1853-1853/com.ikomobi.SuscribeApp E/AppCompatResources: Failed to inflate colorStateList,leaving it to the framework java.lang.UnsupportedOperationException: Can't convert to color: type=0x2 at androID.content.res.TypedArray.getcolor(TypedArray.java:326) at androID.support.v7.content.res.AppCompatcolorStateListInflater.inflate(AppCompatcolorStateListInflater.java:114) at androID.support.v7.content.res.AppCompatcolorStateListInflater.createFromXmlinner(AppCompatcolorStateListInflater.java:88) at androID.support.v7.content.res.AppCompatcolorStateListInflater.createFromXml(AppCompatcolorStateListInflater.java:67) at androID.support.v7.content.res.AppCompatResources.inflatecolorStateList(AppCompatResources.java:116) at androID.support.v7.content.res.AppCompatResources.getcolorStateList(AppCompatResources.java:74) at androID.support.v7.Widget.TintTypedArray.getcolorStateList(TintTypedArray.java:136) at androID.support.v7.Widget.AppCompatTextHelper.onSetTextAppearance(AppCompatTextHelper.java:157) at androID.support.v7.Widget.AppCompatTextVIEw.setTextAppearance(AppCompatTextVIEw.java:148) at androID.support.v4.Widget.TextVIEwCompatGingerbread.setTextAppearance(TextVIEwCompatGingerbread.java:103) at androID.support.v4.Widget.TextVIEwCompat$BaseTextVIEwCompatImpl.setTextAppearance(TextVIEwCompat.java:86) at androID.support.v4.Widget.TextVIEwCompat.setTextAppearance(TextVIEwCompat.java:283) at androID.support.design.Widget.TextinputLayout.setErrorEnabled(TextinputLayout.java:609) at com.ikomobi.SuscribeApp.ui.login.LoginFragment.setUp(LoginFragment.java:81) at com.ikomobi.SuscribeApp.ui.login.LoginFragment.onCreateVIEw(LoginFragment.java:73) at androID.support.v4.app.Fragment.performCreateVIEw(Fragment.java:2192) at androID.support.v4.app.FragmentManagerImpl.movetoState(FragmentManager.java:1299) at androID.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) at androID.support.v4.app.FragmentManagerImpl.movetoState(FragmentManager.java:1595) at androID.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) at androID.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363) at androID.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149) at androID.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103) at androID.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013) at androID.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) at androID.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607) at androID.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) at androID.app.Instrumentation.callActivityOnStart(Instrumentation.java:1163) at androID.app.Activity.performStart(Activity.java:5018) at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2032) at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) at androID.app.ActivityThread.access0(ActivityThread.java:130) at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) at androID.os.Handler.dispatchMessage(Handler.java:99) at androID.os.Looper.loop(Looper.java:137) at androID.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)06-22 09:26:46.897 1853-1853/com.ikomobi.SuscribeApp E/AppCompatResources: Failed to inflate colorStateList,leaving it to the framework java.lang.UnsupportedOperationException: Can't convert to color: type=0x2 at androID.content.res.TypedArray.getcolor(TypedArray.java:326) at androID.support.v7.content.res.AppCompatcolorStateListInflater.inflate(AppCompatcolorStateListInflater.java:114) at androID.support.v7.content.res.AppCompatcolorStateListInflater.createFromXmlinner(AppCompatcolorStateListInflater.java:88) at androID.support.v7.content.res.AppCompatcolorStateListInflater.createFromXml(AppCompatcolorStateListInflater.java:67) at androID.support.v7.content.res.AppCompatResources.inflatecolorStateList(AppCompatResources.java:116) at androID.support.v7.content.res.AppCompatResources.getcolorStateList(AppCompatResources.java:74) at androID.support.v7.Widget.TintTypedArray.getcolorStateList(TintTypedArray.java:136) at androID.support.v7.Widget.AppCompatTextHelper.onSetTextAppearance(AppCompatTextHelper.java:157) at androID.support.v7.Widget.AppCompatTextVIEw.setTextAppearance(AppCompatTextVIEw.java:148) at androID.support.v4.Widget.TextVIEwCompatGingerbread.setTextAppearance(TextVIEwCompatGingerbread.java:103) at androID.support.v4.Widget.TextVIEwCompat$BaseTextVIEwCompatImpl.setTextAppearance(TextVIEwCompat.java:86) at androID.support.v4.Widget.TextVIEwCompat.setTextAppearance(TextVIEwCompat.java:283) at androID.support.design.Widget.TextinputLayout.setErrorEnabled(TextinputLayout.java:609) at com.ikomobi.SuscribeApp.ui.login.LoginFragment.setUp(LoginFragment.java:82) at com.ikomobi.SuscribeApp.ui.login.LoginFragment.onCreateVIEw(LoginFragment.java:73) at androID.support.v4.app.Fragment.performCreateVIEw(Fragment.java:2192) at androID.support.v4.app.FragmentManagerImpl.movetoState(FragmentManager.java:1299) at androID.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) at androID.support.v4.app.FragmentManagerImpl.movetoState(FragmentManager.java:1595) at androID.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) at androID.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363) at androID.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149) at androID.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103) at androID.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013) at androID.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) at androID.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607) at androID.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) at androID.app.Instrumentation.callActivityOnStart(Instrumentation.java:1163) at androID.app.Activity.performStart(Activity.java:5018) at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2032) at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) at androID.app.ActivityThread.access0(ActivityThread.java:130) at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) at androID.os.Handler.dispatchMessage(Handler.java:99) at androID.os.Looper.loop(Looper.java:137) at androID.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)解决方法 我在使用TextinputLayout和设置errorEnabled时遇到了同样的错误
我通过在我的自定义App主题中添加一个textcolorError来解决它:
<style name="YOURCUSTOMtheme" parent="YOUR.PARENT.theme"> <!-- ..... other styles --> <item name="textcolorError">@color/YOUR_color</item></style>总结
以上是内存溢出为你收集整理的android – 无法在TextInputLayout上膨胀ColorStateList全部内容,希望文章能够帮你解决android – 无法在TextInputLayout上膨胀ColorStateList所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)