我查看了许多其他人的问题和解释,但没有任何结果对我有用.我的程序的第一个活动是ListActivity,在填充其xml文件时遇到了麻烦. LogCat输出为:
08-01 08:36:17.800: E/AndroIDRuntime(1935): FATAL EXCEPTION: main08-01 08:36:17.800: E/AndroIDRuntime(1935): java.lang.RuntimeException: Unable to start activity ComponentInfo{jamIE.basketball.gui/jamIE.basketball.gui.TeamdisplayActivity}: androID.vIEw.InflateException: Binary XML file line #15: Error inflating class androID.Widget.ListVIEw08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1647)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.ActivityThread.access00(ActivityThread.java:117)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:931)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.os.Handler.dispatchMessage(Handler.java:99)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.os.Looper.loop(Looper.java:123)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.ActivityThread.main(ActivityThread.java:3683)08-01 08:36:17.800: E/AndroIDRuntime(1935): at java.lang.reflect.Method.invokeNative(Native Method)08-01 08:36:17.800: E/AndroIDRuntime(1935): at java.lang.reflect.Method.invoke(Method.java:507)08-01 08:36:17.800: E/AndroIDRuntime(1935): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)08-01 08:36:17.800: E/AndroIDRuntime(1935): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:597)08-01 08:36:17.800: E/AndroIDRuntime(1935): at dalvik.system.NativeStart.main(Native Method)08-01 08:36:17.800: E/AndroIDRuntime(1935): Caused by: androID.vIEw.InflateException: Binary XML file line #15: Error inflating class androID.Widget.ListVIEw08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java:518)08-01 08:36:17.800: E/AndroIDRuntime(1935): at com.androID.internal.policy.impl.PhoneLayoutInflater.onCreateVIEw(PhoneLayoutInflater.java:56)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:568)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java:623)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:408)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:320)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:276)08-01 08:36:17.800: E/AndroIDRuntime(1935): at com.androID.internal.policy.impl.PhoneWindow.setContentVIEw(PhoneWindow.java:207)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.Activity.setContentVIEw(Activity.java:1657)08-01 08:36:17.800: E/AndroIDRuntime(1935): at jamIE.basketball.gui.TeamdisplayActivity.onCreate(TeamdisplayActivity.java:137)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1611)08-01 08:36:17.800: E/AndroIDRuntime(1935): ... 11 more08-01 08:36:17.800: E/AndroIDRuntime(1935): Caused by: java.lang.reflect.InvocationTargetException08-01 08:36:17.800: E/AndroIDRuntime(1935): at java.lang.reflect.Constructor.constructNative(Native Method)08-01 08:36:17.800: E/AndroIDRuntime(1935): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java:505)08-01 08:36:17.800: E/AndroIDRuntime(1935): ... 22 more08-01 08:36:17.800: E/AndroIDRuntime(1935): Caused by: java.lang.NullPointerException08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.content.res.AssetManager.getResourceTextArray(AssetManager.java:214)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.content.res.Resources.getTextArray(Resources.java:361)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.content.res.TypedArray.getTextArray(TypedArray.java:628)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.Widget.ListVIEw.<init>(ListVIEw.java:168)08-01 08:36:17.800: E/AndroIDRuntime(1935): at androID.Widget.ListVIEw.<init>(ListVIEw.java:159)08-01 08:36:17.800: E/AndroIDRuntime(1935): ... 25 more
我不完全知道发生了什么.我已经检查了AndroID Manifest,第15行是< application,看来好像不是问题.我的XML文件的第15行就是< ListVIEw.我要发布整个XML文件,以防万一其中还有其他问题.
<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:tools="http://schemas.androID.com/tools" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" > <TextVIEw androID:ID="@+ID/num_of_teams" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParenttop="true" androID:layout_centerHorizontal="true" androID:text="@string/deBUG" androID:textAppearance="?androID:attr/textAppearanceLarge" /> <ListVIEw androID:ID="@+ID/@androID:ID/List" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_below="@+ID/num_of_teams" androID:layout_margintop="5dp" androID:entrIEs="@layout/team_List_entry" > </ListVIEw> <button androID:ID="@+ID/delete_team" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_below="@+ID/@androID:ID/List" androID:layout_marginleft="20dp" androID:layout_margintop="30dp" androID:text="@string/delete_team" /> <button androID:ID="@+ID/add_team" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParentleft="false" androID:layout_alignParenttop="false" androID:layout_below="@+ID/@androID:ID/List" androID:layout_marginleft="50dp" androID:layout_margintop="30dp" androID:layout_toRightOf="@ID/delete_team" androID:text="@string/add_team" /> </relativeLayout>
另外,为便于记录,引用TeamdisplayActivity的第137行的堆栈跟踪仅为setContentVIEw(R.layout.team_List_display).任何帮助都将是很棒的,我真的不确定出了什么问题.提前致谢
解决方法:
这行看起来不正确:
androID:entrIEs="@layout/team_List_entry"
通常我认为它被指定为
androID:entrIEs="@array/servers" etc.
并尝试将ID指定为:
androID:ID="@+ID/List"
总结 以上是内存溢出为你收集整理的膨胀类android.widget.listview时出错全部内容,希望文章能够帮你解决膨胀类android.widget.listview时出错所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)