问题
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