首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

List<Map<String, Object>>

2012-08-22 
ListMapString, ObjectMapString, Object itemListMapString, Object listitem new HashMap

List<Map<String, Object>>
Map<String, Object> item;
List<Map<String, Object>> list;

item = new HashMap<String, Object>;
item.put("title","item1");
item.put("price","100");
list.add(item);

item = new HashMap<String, Object>;
item.put("title","item2");
item.put("price","200");
list.add(item);

item = new HashMap<String, Object>;
item.put("title","item1");
item.put("price","300");
list.add(item);


首先,想像有一個表格(Table)如下:
  
titleprice
item1100
item2200
item3300

那么,如果将上述title内容,显示到画面List列表中呢?这相当于有一個 xml 字串如下:
    "<list>
<item>
<title>item1</title>
<price>100</pirce>
</item>
                 <item>
<title>item1</title>
<price>200</pirce>
</item>
<item>
<title>item1</title>
<price>300</pirce>
</item>
</list>"

热点排行