Android 如何查找/创建id为-R.id.list的缺少的ListView?[安卓]

Android 如何查找/创建id为-R.id.list的缺少的ListView?[安卓],android,android-resources,Android,Android Resources,我的android应用程序不工作,我跟踪了错误,发现是以下错误: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.twittersearches_erjan/com.example.twittersearches_erjan.MainActivity}: java.lang.RuntimeException: Your content must have a ListView who

我的android应用程序不工作,我跟踪了错误,发现是以下错误:

java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.example.twittersearches_erjan/com.example.twittersearches_erjan.MainActivity}: 
java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
如何查找R.id.list并删除此错误?

在xml布局中:

<ListView
android:id="@android:id/list" //<-- replace your id tag with this
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>   

如果要扩展
列表活动
,请尝试在xml中使用以下
列表视图

<ListView android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>


或者,您可以扩展norml
Activity
并使用自己的
ListView
和自己的
id

将其添加到布局xml中的listview中,以使用您自己的布局id

android:id="@+id/list"


您的xml布局应具有名为“android.R.id.list”的listview小部件
列表视图的指定id的可能重复项:android:id=“@+id/list”删除
导入android.R来自导入程序包可能重复的
<ListView 
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>