SimpleAdapter String []names=new String[]{"虎头","弄玉","李清照","李白"};
String []descs=new String[]{"good boy","good girl","bad boy","bad girl"};
List<Map<String,Object>>listItems=new ArrayList<Map<String,Object>>();
for(int i=0;i<names.length;i++) {
Map<String, Object> listItem = new HashMap<String, Object>();
listItem.put("header",R.drawable.ic_launcher);
listItem.put("personName", names[i]);
listItem.put("desc", descs[i]);
listItems.add(listItem);
}
//map的key与控件id对应
SimpleAdapter simpleAdapter=new SimpleAdapter(this,listItems,R.layout.simple_item,new String[]{"header","personName","desc"},
new int[]{R.id.header,R.id.name,R.id.desc});
ListView list1=(ListView)findViewById(R.id.list1);
list1.setAdapter(simpleAdapter);