Widget ninepatch - Android 4.0 上的模糊错误?
我在 Android 4.0 上使用 ninepatch 图像时遇到一些问题。在 Gingerbread 下,小部件过去看起来像这样:
gingerbread http://img809.imageshack.us/img809/3313/screenshot1321536776703.png
如您所见,轮廓非常清晰。
在 Android Ice Cream Sandwich 上,小部件看起来完全不同(尽管应用程序根本没有更改):
ics http://img38.imageshack.us/img38/8602/screenshot2011120217535.png
轮廓相当模糊,图标不再好看。我尝试了很多方法来排除这只是错误的 dpi 识别(设备 dpi 变量仍然相同),例如将资源复制到“drawable-nodpi”中。这并没有改变任何事情。
然后我发现有一个图标并不模糊。这是右下角的星星。它与所有其他图像位于同一文件夹中,但它是唯一不是 ninepatch 而是普通图形的图形(iow:文件名中没有 .9)。当我在文件名中添加 .9 时,这颗星星也变得模糊了。
因此,看起来 ICS 会再次缩小和放大图形,最终导致轮廓模糊。
有人也经历过这个吗?这可能是 Android 的一个错误吗?
我很困惑...
干杯!
诺布
I've got some problems with ninepatch images on Android 4.0. Under Gingerbread, the widget used to look like that:
gingerbread http://img809.imageshack.us/img809/3313/screenshot1321536776703.png
As you can see, the contures are quite sharp.
On Android Ice Cream Sandwich, the widget looks quite different (although the app has not been changed at all):
ics http://img38.imageshack.us/img38/8602/screenshot2011120217535.png
The contures are rather blurry, the icons do not look good anymore. I tried a lot to rule out that it's just to a wrong dpi recognition (the devices dpi variable is still the same), for instance copied the resource into "drawable-nodpi". This did not change anything.
Then I recognized that there is one icon which is not blurry. It's the star in the bottom right corner. It's in the same folder than all other images, but it's the only graphic which is not a ninepatch but a normal graphic (iow: there is no .9 in the filename). When I added a .9 to it's filename, this star got blurry too.
So it seems, as if ICS scales the graphics down and up again which ends up in blurry conturs.
Did anybody experienced this too? Might this be an Android bug?
I'm quite puzzled...
Cheers!
Nob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您指的是这个错误:
http://code.google.com/p/android/issues/detail?id=22387&can=1&q=patch%209&colspec=ID%20Type%20Status%20Owner%20Summary% 20Stars
看起来它已经修复了,并且应该很快就会更新(如果还没有为您提供)。它不在 4.0.1 中。
I believe your are referring to this bug:
http://code.google.com/p/android/issues/detail?id=22387&can=1&q=patch%209&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
It looks like it was already fixed and should be in an update soon if not already for you. Its NOT in 4.0.1.