您的内容必须具有一个ListView,其id属性为‘android.R.id.list’。我创建了这样一个XML文件:<?xml version="1.0" encoding="utf-8"?><ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/list" ></ListView>和一项活动:public class ExampleActivity extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainlist);
}}如你所见,我什么也没做。但我发现了一个错误:您的内容必须具有一个ListView,其id属性为‘android.R.id.list’。即使我有android:id="@+id/list"XML中的行。有什么问题吗?
3 回答
![?](http://img1.sycdn.imooc.com/5458626a0001503602200220-100-100.jpg)
肥皂起泡泡
TA贡献1829条经验 获得超6个赞
<ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent"/>
ListActivity
ListView
ListActivity
Activity
![?](http://img1.sycdn.imooc.com/545847f50001126402200220-100-100.jpg)
弑天下
TA贡献1818条经验 获得超8个赞
mainlist.xml
@android:id/list
<ListView android:id="@android:id/list" android:layout_height="wrap_content" android:layout_height="fill_parent"/>
![?](http://img1.sycdn.imooc.com/54584c5e0001491102200220-100-100.jpg)
芜湖不芜
TA贡献1796条经验 获得超7个赞
<ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent"/>
- 3 回答
- 0 关注
- 592 浏览
添加回答
举报
0/150
提交
取消