如何将绘制对象转换为位图? [英] How to convert a Drawable to a Bitmap?

查看:116
本文介绍了如何将绘制对象转换为位图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设定一个特定的绘制对象作为设备的壁纸,但所有的壁纸函数接受位图只发。我不能使用 WallpaperManager ,因为我是pre 2.1。

I would like to set a certain Drawable as the device's wallpaper, but all wallpaper functions accept Bitmaps only. I cannot use WallpaperManager because I'm pre 2.1.

另外,我可绘是从网上下载的,不驻留在 R.drawable

Also, my drawables are downloaded from the web and do not reside in R.drawable.

推荐答案

这将一个BitmapDrawable位图。

This converts a BitmapDrawable to a Bitmap.

Drawable d = ImagesArrayList.get(0);  
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();

这篇关于如何将绘制对象转换为位图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆