android中怎样在listView中的每一个item显示不同的图片
<?xml version="1.0" encoding="UTF-8"?>
<hotels>
<hotel>
<id>1</id>
<name>上海酒店</name>
</hotel>
<hotel>
<id>2</id>
<name>瑞吉酒店</name>
</hotel>
<hotel>
<id>3</id>
<name>餐厅</name>
</hotel>
</hotels>
for(int i=0;i<5;i++)
{
HashMap<String, Object> pMap=new HashMap<String,Object>();
pMap.put("picture",R.drawable.icon);
pMap.put("name", "name"+i);
programeList.add(pMap);
}
SimpleAdapter adapter=new SimpleAdapter(this,programeList,R.layout.list_item, new String[]{"channelPicture","pr"}, new int[]{R.id.img,R.id.name});
listView.setAdapter(adapter);
有每个餐厅的图片,解析xml得到餐厅名,怎样把餐厅的的图片加到listview的每个item中
显示成:
餐厅图片1 上海酒店
餐厅图片2 瑞吉酒店
餐厅图片3 餐厅