如何将位图转换为android中的drawable?


如何将位图图像转换为Drawable?

谢谢, 法哈

听起来像你想使用BitmapDrawable

从文档:

A Drawable that wraps a bitmap and can be tiled, stretched, or aligned.
You can create a BitmapDrawable from a file path, an input stream, through
XML inflation, or from a Bitmap object.

试试这个将Bitmap类型的图像转换为Drawable

Drawable d = new BitmapDrawable(getResources(), bitmap);

未经作者同意,本文严禁转载,违者必究!