Java findViewById(R.id.list)未解析?

Java findViewById(R.id.list)未解析?,java,android,Java,Android,findViewById(R.id.list)未解析 我收到以下错误消息: 无法解析R.id.list 我正在扩展ListActivity,在布局中我有ListView android:id=“@android:id/list” 公共类结果扩展了ListActivity{ 静态最终字符串TAG=“Results”; ListView m_lv; List m_dataList=null; ListView lv; SimpleAdapter m_适配器; ProgressDialog m_dia

findViewById(R.id.list)未解析

我收到以下错误消息: 无法解析R.id.list

我正在扩展ListActivity,在布局中我有ListView android:id=“@android:id/list”

公共类结果扩展了ListActivity{
静态最终字符串TAG=“Results”;
ListView m_lv;
List m_dataList=null;
ListView lv;
SimpleAdapter m_适配器;
ProgressDialog m_dialog;
异步任务bg;
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.listviewparent);
lv=(ListView)findViewById(R.id.list);
lv=getListView();
以下是listviewparent.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <LinearLayout style="@style/TitleBar">
        <ImageButton style="@style/TitleBarAction"
            android:contentDescription="@string/description_home"
            android:src="@drawable/title_home"
            android:onClick="onClickHome" />
        <ImageView style="@style/TitleBarSeparator" />
        <TextView style="@style/TitleBarText" />
        <ImageButton style="@style/TitleBarAction"
            android:contentDescription="@string/description_about"
            android:src="@drawable/title_about"
            android:onClick="onClickAbout" />
        <ImageButton style="@style/TitleBarAction"
            android:contentDescription="@string/description_search"
            android:src="@drawable/title_search"
            android:onClick="onClickSearch" />
    </LinearLayout>
 <ListView android:id="@android:id/list"
        android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="0px"/>   
</LinearLayout>

有什么想法吗


提前感谢。

对于R.id.list,名称空间必须是
android.R
,但是对于您的视图父级,您的
R
是您的程序名称空间之一。只需将
android.list
添加到
R.id.list
的开头,即可修复名称空间。

使用以下方法:

findViewById(android.R.id.list)

注释lv=(ListView)findViewById(R.id.list);并检查lv=getListView()是否返回list?您的布局中没有具有该id的ListView。请改为尝试使用android.R.id.list。感谢alextsc这么做!!!
findViewById(android.R.id.list)