我想知道为什么这个简单的列表视图没有出现。错误说(简而言之)-您的内容必须具有 ID 为“android.R.id.list”的 LisView...
public class MyListView extends ListActivity {
static final String[] PENS = new String[]{
"MONT Blanc",
"Gucci",
"Parker",
"Sailor",
"Porsche Design",
"Rotring",
"Sheaffer",
"Waterman"
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_view);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, PENS);
setListAdapter(adapter);
}
}