您的位置:首页 > 移动开发 > Android开发

Android Bitmap 与 Drawable之间的转换

2010-12-05 18:26 399 查看
转自:http://hi.baidu.com/xiaopengzyz/blog/item/e898fb0868cc84c23ac763c3.html

Android Bitmap 与 Drawable之间的转换

转换Bitmap to Drawable

Java代码

BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap;

Drawable drawable = (Drawable)bitmapDrawable;

Bitmap bitmap = new Bitmap (...);

Drawable drawable = new BitmapDrawable(bitmap);

BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap;    Drawable drawable = (Drawable)bitmapDrawable;          Bitmap bitmap = new Bitmap (...);    Drawable drawable = new BitmapDrawable(bitmap);


转换Drawable to Bitmap

Java代码

Drawable d = ImagesList.get(0);

Bitmap bitmap = ((BitmapDrawable)d).getBitmap();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: