当前位置: 代码迷 >> Android >> Android Drawable 跟 Bitmap相互转换
  详细解决方案

Android Drawable 跟 Bitmap相互转换

热度:147   发布时间:2016-05-01 20:16:49.0
Android Drawable 和 Bitmap相互转换


/**
* drawable 转 bitmap
* @param drawable
* @return
*/
public Bitmap drawable2Bitmap(Drawable drawable){
BitmapDrawable bd = (BitmapDrawable)drawable;
return bd.getBitmap();
}

/**
* bitmap 转 drawable
* @param bitmap
* @return
*/
public Drawable bitmap2Drawable(Bitmap bitmap){
return new BitmapDrawable(bitmap);
}

  相关解决方案