简体   繁体   English

您的内容必须具有ID属性为“ android.R.id.list”错误的ListView

[英]Your content must have a ListView whose id attribute is 'android.R.id.list' error

When I'm trying to run my program I have the next error. 当我尝试运行程序时,出现下一个错误。 I watched other similar questions and the guys asked if they have a List View's in their code. 我看了其他类似的问题,这些家伙问他们的代码中是否有一个列表视图。 The problem is that I haven't got List View's or List Activities in my code. 问题是我的代码中没有列表视图或列表活动。

Here is my project on GitHub . 这是我在GitHub上的项目。

Here is the error log: 这是错误日志:

08-08 19:41:53.948 2473-2473/su.rck.networkcontrol E/AndroidRuntime: FATAL EXCEPTION: main
Process: su.rck.networkcontrol, PID: 2473
java.lang.RuntimeException: Unable to start activity ComponentInfo{su.rck.networkcontrol/su.rck.networkcontrol.BidListActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2193)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5019)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
at android.support.v4.app.ListFragment.ensureList(ListFragment.java:346)
at android.support.v4.app.ListFragment.onViewCreated(ListFragment.java:147)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1343)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1574)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1641)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:794)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2200)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2153)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2063)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:554)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1188)
at android.app.Activity.performStart(Activity.java:5241)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2166)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243) 
at android.app.ActivityThread.access$800(ActivityThread.java:135) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5019) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 

You are using Change your BidListFragment extends ListFragment to BidListFragment extends Fragment it will work fine. 您正在使用将BidListFragment extends ListFragment更改为BidListFragment extends Fragment ,它将正常工作。 And you are not using Any property of ListFragment, So you can use Fragment itself 而且您没有使用ListFragment的Any属性,因此可以使用Fragment本身

Check this 检查一下

To do this, your view hierarchy must contain a ListView object with the id "@android:id/list" (or list if it's in code) 为此,您的视图层次结构必须包含ID为“ @android:id / list”(或列表,如果在代码中,则为List)的ListView对象

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Logcat错误内容必须具有ID属性为'android.R.id.list'的ListView - Logcat error-Content must have a ListView whose id attribute is 'android.R.id.list' Android:内容必须有一个 id 属性为 'android.R.id.list 的 ListView - Android: Content must have a ListView whose id attribute is 'android.R.id.list ListFragment:运行时错误“您的内容必须具有ID属性为'android.R.list'的ListView - ListFragment: Runtime error "Your content must have a ListView whose id attribute is 'android.R.list' FATAL EXCEPTION:main java.lang.RuntimeException:Content具有id属性'android.R.id.list'的视图,它不是ListView类 - FATAL EXCEPTION: main java.lang.RuntimeException: Content has view with id attribute 'android.R.id.list' that is not a ListView class 为什么我会收到“您的 TabHost 必须有一个 TabWidget,其 id 属性为‘android.R.id.tabs’”错误? - Why do I get an "Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabs'" error? Android Listview质疑``android.R.id.list'' - Android Listview questioned 'android.R.id.list' Android android.R.id.list ListView Fragment异常 - Android android.R.id.list ListView Fragment Exception 在ListFragment中找不到ListView'android.R.id.list' - ListView 'android.R.id.list' is not found in ListFragment 扩展ListActivity android.R.id.list - Extending ListActivity android.R.id.list Android必须具有ID为的Expandableview - Android must have Expandableview whose id is
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM