setContentView(R.layout.activity_main); ListView listView = (ListView)this.findViewById(R.id.listView);//listViewString[] strs = new String[]{"1","2","3","4"};//listView要显示的数据ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,strs);//listView相关数据和视图的适配器listView.setAdapter(adapter);//进行适配
时间: 2024-10-04 16:01:05