ListView的使用1 ① ListView 的声明、定义 ② 数组适配器的生命定义 ③ 给ListView 设置数组适配器 ④ 设置ListView 的元素被选中时的事件处理监听器 ⑤ 事件处理监听器方法 ⑥ 让ListView 中的内容变化,重新设置一个ArrayAdapter 即可 ListView list=new ListView(this); String []name=new String[]{"Java","C++","C","C#","VB","XML",".NET","J#"}; ArrayAdapter<String> arrayadapter =new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,name); list.setAdapter(arrayadapter); list.setOnItemClickListener(this); @Override public void onItemClick(AdapterView<?> arg0,View arg1,int arg2,long arg3) { // TODO Auto-generated method stub setTitle(GetData(arg2)); } String []score=new String[]{"93","76","84","85","93","88","78"}; ArrayAdapter<String> arratadapter2=new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,score); list.setAdapter(arratadapter2);