我有一张照片Uri,我想在listView中显示它,我该怎么办? 这是我的代码
Uri img = getImgByContactId(Long id);
map.put("imgcontact", ???? img ??????);
map.put("date", "20/2010");
map.put("duration", String.valueOf(duration));
map.put("type", finalTypeImg);
SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.calllogtemplate,
new String[] {"num", "name", "imgcontact", "date", "duration", "type"},
new int[] {R.id.num, R.id.name, R.id.imgcontact, R.id.date, R.id.duration, R.id.typecall});
ListView maListViewPerso = (ListView) findViewById(android.R.id.list);
maListViewPerso.setAdapter(mSchedule);
感谢
答案 0 :(得分:0)
查看此适配器,可以为您节省几个小时的工作时间:https://github.com/tbiehn/Android-Adapter-Image-Loader
答案 1 :(得分:0)
在ImageView中使用Drawable setImageUri(uri)然后使用setDrawable。在适配器的getView()中的ViewHolder中使用ImageView。阅读有关BaseAdapter的信息。希望它有助于升技。 干杯