英文:
Can't create bitmap without Color space android
问题
我想重新调整一个位图的大小。
我尝试了许多函数来完成这个操作,但是由于颜色空间的问题,没有一个能与我一起工作。
错误信息是“无法创建没有颜色间距的位图”。
我使用了Bitmap.createScaledBitmap(params...)
和Bitmap.createBitmap(Bitmap source, int width, int height, Matrix matrix, boolean filter)
。
始终出现相同的异常,我不知道该怎么办。
英文:
I wanted to rescale a bitmap
I tried a lot of functions to do it and no one worked with me because of color space ,
The error is "can't create bitmap without color spacing"
I used the Bitmap.createScaledBitmap(params...)
And
Bitmap.createBitmap(Bitmap source, int width, int height, Matrix matrix, boolean filter)
Always same exception , i don't know what to do with it
答案1
得分: 0
抱歉,由于你的要求,我将只翻译指定的部分:
我在尝试在Android Studio中渲染自定义视图时遇到了相同的错误。然而,当在设备本身上运行代码时,它却能正常工作。
不幸的是,ColorSpace
是在API 26中添加的,因此如果你的问题的根源相同,我不认为有任何办法可以实现这一点 - 顺便说一下,我们并不知道根源是否相同。
英文:
I get the same error for my custom view when I try to render it in Android Studio. The code however is working fine when run on the device itself.
Unfortunately ColorSpace
was added in API 26 and therefore I don't see any way of achieving this if the root of your problem is the same - which we don't know by the way.
专注分享java语言的经验与见解,让所有开发者获益!
评论