Bitmap与Drawable之间的转换(Android)

转换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:临时用到的, 小总结下… …

posted @ 2011-08-18 10:16  健康小树  阅读(4291)  评论(0)    收藏  举报