Transparent 9patch image: line showing through

爱⌒轻易说出口 提交于 2019-12-10 16:09:14

问题


I got a transparant 9patch image which has the 9patch lines showing trough.

This is the output:

Obviously I don't want the horizontal lines to be visible.

This is how I created the 9patch:

This is the final image that is used in the application:

AFAIK the 9patch is correct. What do I need to change in order for the horizontal lines to disappear?


回答1:


The unwanted lines come from the fixed (non-stretched) parts of the ninepatch overlapping. This is happening because you are drawing it at a pixel height that is smaller than the sum of the heights of the fixed sections.

As @kcoppock said above and then curiously retracted, the left hand edge should be solid black where it is vertically stretchable.




回答2:


Try connecting the two dots on the left edge, making it a solid line, see if that fixes the problem. You also only need 1 dot along the top for the exact same result.

EDIT: Ignore the above, I don't know what I was thinking. Connecting the line on the left is definitely not allowed, that's my mistake.

EDIT: Ignore the above edit -- Reuben's right. :)

I don't know that it's what's causing the problem, but I noticed that along the top edge, there are some pixels that are not fully transparent (e.g. pixels(5,0) through (28,0) are a very light shade of gray) likely due to some bleeding over of the anti-aliasing of the shape. Try flattening the image, and erasing all the outermost pixels, other than the black pixels, of course. That should only cause a compiler error, though, it shouldn't cause that sort of an artifact. I wish I could test it myself right now but I can't.



来源:https://stackoverflow.com/questions/4792873/transparent-9patch-image-line-showing-through

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!