Android Bitmap 与 Drawable之间的转换


转换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(); 


你可能感兴趣的:(android,image)