1 public SimpleAdapter getSimpleAdapter(BillModel bm) 2 { 3 ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String, Object>>(); 4 for(int i=0;i<15;i++) 5 { 6 HashMap<String, Object> map = new HashMap<String, Object>(); 7 map.put("ItemImage", R.drawable.icon);//图像资源的ID 8 map.put("ItemTitle", bm.getC_billno()); 9 map.put("ItemText", bm.getC_billlx()+bm.getC_billbm()); 10 listItem.add(map); 11 } 12 //生成适配器的Item和动态数组对应的元素 13 SimpleAdapter listItemAdapter = new SimpleAdapter(this,listItem,//数据源 14 R.layout.billlist,//ListItem的XML实现 15 //动态数组与ImageItem对应的子项 16 new String[] {"ItemImage","ItemTitle", "ItemText"}, 17 //ImageItem的XML文件里面的一个ImageView,两个TextView ID 18 new int[] {R.id.ImageView01,R.id.Textbillno,R.id.TextDetail} 19 ); 20 return listItemAdapter; 21 }