开发者

listview about adapter, for create a hashmap, why bitmap type imported cannot show image in listview?

   list_data = list_data_add("111","222",icon);

    adapter开发者_运维问答 = new SimpleAdapter(
            this, list_data, R.layout.list_item_detail,
            new String[]{"title","desc","icon"},
            new int[]{R.id.title, R.id.desc, R.id.icon}
    );
    listview.setAdapter(adapter);

private List<Map<String, Object>> list_data_add(String title, String desc, Bitmap icon) {
    List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

        Map<String, Object> map;
        map = new HashMap<String, Object>();

        map.put("title", title);
        map.put("desc", desc);
        map.put("icon", icon);
        list.add(map);

    return list;
} 

hi, the icon is Bitmap type, but this way it doesn't show any image in listview, but if change icon to int type, and set icon = R.drawable.icon_folder , and import to list_data_add to create a hashmap, it could show a android drawable resource image in listview.

so, could anyone can help me to solve this? tks!


ok i got it, SimpleAdapter does not accpect Bitmap, create a baseadapter then it's fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜