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 d = ImagesList.get(0);
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();

 

你可能感兴趣的:(android)