标签:
SimpleAdapter listItemAdapter = new SimpleAdapter(this, listItem, R.layout.items_list, new String[] { "imagePath", "name", "njname", "length", "id" }, new int[] { R.id.imagePath, R.id.name, R.id.njname, R.id.length, R.id.hiddenId });
第一步:设置listItemAdapter
listItemAdapter.setViewBinder(new CustomViewBinder());
第二步:
import android.graphics.Bitmap; import android.view.View; import android.widget.ImageView; import android.widget.SimpleAdapter.ViewBinder; public class CustomViewBinder implements ViewBinder { public boolean setViewValue(View view, Object data, String textRepresentation) { if ((view instanceof ImageView) & (data instanceof Bitmap)) { ImageView iv = (ImageView) view; Bitmap bm = (Bitmap) data; iv.setImageBitmap(bm); return true; } return false; } }
标签:
原文地址:http://www.cnblogs.com/butterfly-clover/p/4462330.html