本文介绍了java.lang.RuntimeException的:你的内容必须有一个ListView,其id属性是'android.R.id.list“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,一直存在simialr问题,但我不能让虽然我看那些它甚至工作。该错误信息是:java.lang.RuntimeException的:你的内容必须有一个ListView,其id属性是android.R.id.list。我曾试图改变ID列出。在另一回事。这是什么code是这样的:

它使用以下适配器:

下面是XML文件,指定列表(fragment_committee):

下面是XML列表项:

我希望你能弄清楚什么是错的。我还有一个列表视图已在另一个XML文件whithin项目相同的ID(清单)。我不知道这是一个问题。请帮我解决这个问题。

解决方案

该问题是在这里:

 机器人:ID =@ + ID /列表
 

要添加一个新的ID为您的ListView但ListFragment需要一个默认的Andr​​oid ListView控件ID为

改变你的ListView编号为:

I know that there has been simialr questions but I can't make it work even though I look at those. The error message is: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'. I have tried to change the id to list. In another. This what the code looks like:

It's using the following adapter:

Here is the xml-file that specifies the list(fragment_committee):

Here is the xml for the list item:

I hope that you can figure out what's wrong. I have another listview that has the same id (list) in another xml-file whithin the project. I don't know if that's a problem. Please help me solve the problem.

解决方案

The problem is here :

android:id="@+id/list"

you are adding a new id for your ListView but ListFragment needs a default Android ListView Id

change your ListView Id to :

这篇关于java.lang.RuntimeException的:你的内容必须有一个ListView,其id属性是'android.R.id.list“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 22:49
查看更多