Drawable与Bitmap的相互转换

二者相互转化的代码十分简单,如下:

//Drawable--->Bitmap
public static Bitmap drawableToBitmap(Drawable drawable) {
    return ((BitmapDrawable)drawable).getBitmap();
}
//Bitmap--->Drawable
public static Drawable bitmapToDrawable(Bitmap bitmap){
    return new BitmapDrawable(bitmap);
}
原文地址:https://www.cnblogs.com/ihou/p/2119492.html