android ListView 中的ImageView显示Drawable类型的图
使用SimpleAdapter中的ViewBinder方法实现
SimpleAdapter notes=new SimpleAdapter(this,list,R.layout.info_row, new String[]{"img","name","desc"},new int[]{R.id.img,R.id.name,R.id.desc}); itemlist.setAdapter(notes); notes.setViewBinder(new ViewBinder(){ public boolean setViewValue(View view,Object data,String textRepresentation){ if(view instanceof ImageView && data instanceof Drawable){ ImageView iv=(ImageView)view; iv.setImageDrawable((Drawable)data); return true; } else return false; } });