首页 > 其他 > 详细

Drawable和Bitmap转换

时间:2014-11-23 01:53:20      阅读:259      评论:0      收藏:0      [点我收藏+]

一、Bitmap转Drawable

Bitmap mBitMap=getYourBitMap(); //getYourBitMap()是你获取BitMap的方法

BitmapDrawable mBitDrawable=new BitmapDrawable(mBitMap);

//BtimapDrawable是Drawable的子类,直接把mBitDrawable对象当作Drawable使用即可。

 

二、 Drawable转Bitmap

Drawable mDrawable=getYourDrawable (); //getYourDrawable()是你获取Drawable 的方法

BitmapDrawable mBitDrawable= (BitmapDrawable) mDrawable;

Bitmap mBitMap= mBitDrawable.getBitmap(); //最后通过mBitDrawable的自带的方法获取需要的Bitmap对象。

Drawable和Bitmap转换

原文:http://www.cnblogs.com/wytings/p/4116053.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!