Android nine-patch content-border not honoured

烈酒焚心 提交于 2019-12-02 07:04:42

问题


I have a 9-patch image. I defined top left quadrant to be a content area, yet it is not honoured (see the preview on the right hand side of the screenshot). What am I missing? Thanks!


回答1:


The content region is defined by the right and lower bars as mentioned above, but what you are really defining is the padding (top,left,bottom and right padding).

The padding is set by counting the number of transparent pixels at the start and end of the right and lower bars. So the padding would be approx 10,10,40,40 (t,l,b,r) if your image was 100x100.

When the image is stretched, the padding doesn't change and since it is measure from each edge, that explains why the content area stretches the way it does.




回答2:


Your content area, defined by the right and lower black bars, is fully contained in the stretchable region, defined by the upper and left black bars. Hence the content region will also be stretched, this is intended.



来源:https://stackoverflow.com/questions/20961745/android-nine-patch-content-border-not-honoured

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