android bitmap转image

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 15:54   2032   0
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;
}


分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP