在ListView中添加动态图像

时间:2011-12-11 17:26:01

标签: java android xml

所以,基本上我正在使用ListView,暂时看起来像这样:

http://img74.xooimage.com/files/9/7/5/sample1-2f8fa7a.jpg

(作为新用户,我无法发布图片..)

我添加列表中的每个元素:

map = new HashMap<String, String>();
map.put("ing_name", "Mozzarella");
listItem.add(map);
map = new HashMap<String, String>();
map.put("ing_name", "Emmental");
listItem.add(map);

我想为每个元素添加不同的图片,最终得到类似的东西(我支持它):

http://img74.xooimage.com/files/b/2/7/sample2-2f8fa8c.jpg

我尝试了一些东西,但找不到一个有用的东西。 有人知道怎么做吗?

感谢。 : - )

1 个答案:

答案 0 :(得分:1)

尝试使用Simple适配器类。以下链接可能会有所帮助。

Simple adapter example

我希望它有所帮助..

相关问题