【发布时间】:2014-06-09 14:23:10
【问题描述】:
我设法在我的列表视图中使用了可绘制的图像,但我怎样才能对 SD 卡中的图像执行相同的操作?
ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
map.put("KEY_IMAGE", Integer.toString(R.drawable.a)); //change to SD card
map.put("KEY_LINK", "link");
map.put("KEY_NAME", "name");
menuItems.add(map);
String[] from = { "KEY_IMAGE", "KEY_NAME", "KEY_LINK" };
int[] to = {R.id.imageView_cell, R.id.list_headline,R.id.list_info };
SimpleAdapter adapter = new SimpleAdapter(getApplicationContext(), menuItems, R.layout.list_view,from, to);
listview.setAdapter(adapter);
【问题讨论】: