Reputation: 263
I've got a problem with a 9-patch when used as a background. I add an image to clarify it.
Image:
This is the 9-patch:
Why is that white line there?
Upvotes: 0
Views: 375
Reputation: 134664
Okay, well firstly, you have more stretch pixels than you need. It's not the cause of your problem but you only need one black pixel on the top and left. Secondly, you should be defining your content area to entail only the white area (as shown below). Lastly, I believe your problem is that Android is scaling your graphic. Do you have your 9-patch in the appropriate density folder? (i.e. if you're on an XHDPI device, is the 9-patch in drawable-xhdpi
?). One thing you can do to avoid scaling altogether is to place your 9-patch in res/drawable-nodpi
, but this will use the same graphic for all densities. This may or may not be what you need.
Here is a revised 9-patch that you should try along with the folder location suggestions above:
Upvotes: 1