码迷,mamicode.com
首页 > 其他好文 > 详细

Drawable和Bitmap转换

时间:2014-11-23 01:55:34      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:style   color   使用   sp   on   bs   size   new   nbsp   

一、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转换

标签:style   color   使用   sp   on   bs   size   new   nbsp   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!