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)如下:
title price
item1 100
item2 200
item3 300
那么,如果将上述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>"
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)如下:
title price
item1 100
item2 200
item3 300
那么,如果将上述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>"