我需要扩展 ListActivity 并填充自定义布局,所以我执行以下操作
public class BizList extends ListActivity {
String bizNames[]={"one", "two","theree","four"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.bizlist);
//ListView listviewMe = (ListView)findViewById(android.R.id.list);
//ListView listview = this.getListView();
setListAdapter(new ArrayAdapter<String>(this, android.R.id.list, bizNames));
/* ListView list1 = (ListView) findViewById(R.id.listView1);
list1.setAdapter(new ArrayAdapter<String>(getApplicationContext(),R.layout.list_item,startDates_str));;*/
}
我的布局中的 ListView 是
<ListView
android:id="@id/android:list"//***have also tried*** android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/imageView2"
android:layout_centerHorizontal="true" >
</ListView>
但我不断收到此错误
android.content.res.resources$notfoundexception: 文件表单xml类型布局资源ID
非常感谢任何和所有帮助。我希望这很简单。谢谢你。