1、bitmap转换为drawable
public static Drawable bitmap2Drawable(Bitmap bitmap)
{
if(bitmap == null)
return null;
else
return new BitmapDrawable(bitmap);
}
2、drawable转换为bitmap
public static Bitmap drawable2Bitmap(Drawable drawable)
{
if(drawable == null)
return null;
else
return ((BitmapDrawable)drawable).getBitmap();
}
原创内容转载请保留出处GEEK笔记(https://www.geekapp.cn/)。