9 patch fill area not working with multiple scale areas

这一生的挚爱 提交于 2019-12-12 18:41:54

问题


In my 9 patch I've added a fill area to be the contents taking most of the width and from below the red rectangle. However as the scale images show it's not working. If I remove the scale area shown by the arrow then it works perfectly.

What am I doing wrong or not understanding about 9 patch?

Thanks.


回答1:


I found a related answer that explains it perfectly for me:

  • Android nine-patch content-border not honoured

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).

So think of it in terms of "padding" around the content area, as defined by the white pixels.

Check out the linked answer for more detail.




回答2:


I don't know what is your image,but I think it is better to exclude the red rectangle from image. Then use a layout and put your background image, for its background, and add Image element in that layout for displaying your red rectangle.



来源:https://stackoverflow.com/questions/18568085/9-patch-fill-area-not-working-with-multiple-scale-areas

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