【转】Android Bitmap 与 Drawable之间的转换

来源:互联网 发布:java语言应用领域 编辑:程序博客网 时间:2024/05/18 00:05

from:http://www.cnblogs.com/yangxiao24/archive/2011/03/03/1970137.html

 

转换Bitmap to Drawable

  1. Bitmap bitmap = new Bitmap (...);       
  2. Drawable drawable = new BitmapDrawable(bitmap);

 

转换Drawable to Bitmap
  1. Drawable d = ImagesList.get(0);    
  2. Bitmap bitmap = ((BitmapDrawable)d).getBitmap();