Bitmap bm = BitmapFactory.decodeFile(lis.get(position).toString());
BitmapDrawable drawable = new BitmapDrawable(bm);
// 加载资源里的图片 private void generateBitmaps() { mBitmaps.clear(); int[] ids = { R.drawable.center_children, R.drawable.center_boya, R.drawable.center_store, R.drawable.center_youpeng, R.drawable.center_yu }; for (int id : ids) { Bitmap bitmap = createReflectedBitmapById(id); if (null != bitmap) { BitmapDrawable drawable = new BitmapDrawable(bitmap); drawable.setAntiAlias(true); mBitmaps.add(drawable); } } } private Bitmap createReflectedBitmapById(int resId) { Drawable drawable = getResources().getDrawable(resId); if (drawable instanceof BitmapDrawable) { Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); // Bitmap reflectedBitmap = // BitmapUtil.createReflectedBitmap(bitmap); return bitmap; } return null; } |