您的位置:首页 > 移动开发 > Android开发

Android Bitmap 与 Drawable之间的转换

2012-06-08 16:12 369 查看
转换Bitmap to Drawable

BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap;
Drawable drawable = (Drawable)bitmapDrawable;

Bitmap bitmap = new Bitmap (...);
Drawable drawable = new BitmapDrawable(bitmap);


转换Drawable to Bitmap

Drawable mydDrawable = getBackground();
Bitmap image = ((BitmapDrawable)mydDrawable).getBitmap();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: