我必须将白色背景和黑色前景设置为列表。
生成的错误如下所示:
08-11 23:50:12.050: ERROR/AndroidRuntime(3288): Uncaught handler: thread main exiting due to uncaught exception
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.list.view/com.list.view.ContentUserDemo}: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ListView
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.os.Handler.dispatchMessage(Handler.java:99)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.os.Looper.loop(Looper.java:123)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.ActivityThread.main(ActivityThread.java:4363)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at java.lang.reflect.Method.invokeNative(Native Method)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at java.lang.reflect.Method.invoke(Method.java:521)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at dalvik.system.NativeStart.main(Native Method)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ListView
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.Activity.setContentView(Activity.java:1622)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at com.list.view.ContentUserDemo.onCreate(ContentUserDemo.java:14)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): ... 11 more
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): Caused by: java.lang.reflect.InvocationTargetException
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.widget.ListView.<init>(ListView.java:148)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at java.lang.reflect.Constructor.constructNative(Native Method)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): ... 23 more
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi/list_view.png from drawable resource ID #0x7f060001
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.content.res.Resources.loadDrawable(Resources.java:1710)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.View.<init>(View.java:1850)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.view.ViewGroup.<init>(ViewGroup.java:290)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.widget.AdapterView.<init>(AdapterView.java:228)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.widget.AbsListView.<init>(AbsListView.java:508)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.widget.ListView.<init>(ListView.java:152)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): ... 27 more
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): Caused by: java.io.FileNotFoundException: res/drawable-hdpi/list_view.png
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.content.res.AssetManager.openNonAssetNative(Native Method)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.content.res.AssetManager.openNonAsset(AssetManager.java:390)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): at android.content.res.Resources.loadDrawable(Resources.java:1702)
08-11 23:50:12.091: ERROR/AndroidRuntime(3288): ... 33 more
答案 0 :(得分:0)
res/drawable-hdpi/list_view.png
它的说法,我在list_view.png
文件夹中找不到drawable
..检查图片是否存在或者您是否给出了错误的名称..