无法在Android中创建没有颜色空间的位图。

huangapple 未分类评论46阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年7月23日 23:42:54
  • 转载请务必保留本文链接:https://java.coder-hub.com/63058079.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定