InflateException:填充类片段时出错

时间:2016-12-16 05:46:20

标签: android android-fragments layout-inflater

我的应用程序在API级别18+上运行良好。但是,当我在API 18上运行它时,它会崩溃并出现以下异常:

java.lang.RuntimeException: Unable to start activity ComponentInfo
{navdrawer.test.com.navigationdrawertest/navdrawer.test.com.navigationdrawertest.MainActivity}: 
android.view.InflateException: Binary XML file line #111: Error inflating class fragment
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362)
   at android.app.ActivityThread.access$700(ActivityThread.java:168)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:176)
   at android.app.ActivityThread.main(ActivityThread.java:5493)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:525)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #111: Error inflating class fragment
   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:804)
   (many similar exception lines)

Caused by: java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called.
   at android.widget.ListView.addHeaderView(ListView.java:265)
   at android.widget.ListView.addHeaderView(ListView.java:294)
   (many similar exception lines)

i'm try on this site

我做错了什么?

1 个答案:

答案 0 :(得分:-1)

检查您可能使用Api 18

不支持的错误属性的相关xml文件