android.view.InflateException:二进制XML文件行#1:错误类膨胀

前端之家收集整理的这篇文章主要介绍了android.view.InflateException:二进制XML文件行#1:错误类膨胀前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
将ActionBarCompat NavDrawer添加到我的项目中,在4.3设备上运行顺利,在2.3设备上我得到以下异常:
09-08 15:09:15.229: E/AndroidRuntime(2964): FATAL EXCEPTION: main
09-08 15:09:15.229: E/AndroidRuntime(2964): android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.AbsListView.obtainView(AbsListView.java:1582)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.makeAndAddView(ListView.java:1801)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.fillDown(ListView.java:724)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.fillFromTop(ListView.java:781)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.layoutChildren(ListView.java:1652)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.AbsListView.onLayout(AbsListView.java:1412)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:702)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1146)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1866)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.os.Looper.loop(Looper.java:130)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.app.ActivityThread.main(ActivityThread.java:3687)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Method.invokeNative(Native Method)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Method.invoke(Method.java:507)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at dalvik.system.NativeStart.main(Native Method)
09-08 15:09:15.229: E/AndroidRuntime(2964): Caused by: java.lang.reflect.InvocationTargetException
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Constructor.constructNative(Native Method)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.createView(LayoutInflater.java:505)
09-08 15:09:15.229: E/AndroidRuntime(2964):     ... 35 more
09-08 15:09:15.229: E/AndroidRuntime(2964): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.content.res.Resources.loadDrawable(Resources.java:1681)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.<init>(View.java:1951)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.TextView.<init>(TextView.java:389)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.TextView.<init>(TextView.java:382)
09-08 15:09:15.229: E/AndroidRuntime(2964):     ... 38 more

我根据手册设置了一切,并提供了正确的支持包……

任何的想法 ?
如何确定罪魁祸首xml文件

解决方法

然后将ActionBarCompat添加到google的Navigation Drawer示例中,不要忘记将原始方法更改为SupportMethods:getActionBar() – > getSupportActionBar(); invalidateOptionsMenu() – > supportInvalidateOptionsMenu(); …

并从drawer_list_item.xml和其他属性“?android:attr / …”中删除仅适用于API 14的属性

great tutorial by Gabriele Mariotti必须帮助你.

原文链接:https://www.f2er.com/android/315486.html

猜你在找的Android相关文章