Android用simpleAdapter来直接显示Bitmap图片
程序员文章站
2022-03-29 14:07:43
...
SimpleAdapter定义:
ArrayList<HashMap<String, Object>> mFileList = new ArrayList<HashMap<String, Object>>();
SimpleAdapter mFileSimpleAdapter = new SimpleAdapter(this, mFileList, R.layout.file_listview_item, new String[] { "icon", "name" }, new int[] {
R.id.file_icon, R.id.file_name });
mFileSimpleAdapter.setViewBinder(new ViewBinder() {
@Override
public boolean setViewValue(View view, Object data, String textRepresentation) {
// TODO Auto-generated method stub
if((view instanceof ImageView) & (data instanceof Bitmap)){
ImageView imageView = (ImageView)view;
Bitmap mBitmap = (Bitmap)data;
imageView.setImageBitmap(mBitmap);
return true;
}
return false;
}
});
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("icon", (Object)mBitmap);
map.put("name", mTempFile.getName());
mFileList.add(map);
上一篇: Android使用surface直接显示yuv数据(三)
下一篇: Android直接播放yuv数据