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

Bitmap与Drawable之间的转换(Android)

2011-08-18 10:16 381 查看
转换Bitmap to Drawable

//pattern 1

BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap;  
Drawable drawable = (Drawable)bitmapDrawable;   
//pattern 2
Bitmap bitmap = new Bitmap (...);  
Drawable drawable = new BitmapDrawable(bitmap);

转换Drawable to Bitmap

Drawable d = ImagesList,get(0);

Bitmap bitmap = ((BitmapDrawable)d).getBitmap();

ps:临时用到的, 小总结下… …
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: