Reputation: 2761
I am trying to create a nine patch drawable
. I created an image with a white border and then opened it in Draw9patch
software as explained here:
I don't understand what I am supposed to do. I drew some kind of black border around it, and it gives me errors when I try to us it in my app. I have tried to draw a red border around it and it also gives the same errors that the nine patch is not valid.
Sometimes the area of the nine patch shows in pink and sometimes in green. I don't understand what it means and nothing is explained anywhere.
Upvotes: 0
Views: 656
Reputation: 42016
There is nothing complicated in 9Patch image let me explain you via example(image)
Top
and Left
parts are stretchable area, this part will increase when your screen size increase
You can see pink dotted box in the 1st part of image that show this
part will resize.
Bottom
and Right
parts are for content padding, your content will reside in this part only(reserve your content area).
You can see pink dotted box in the 2st part of image that show this
part is for your content(string or etc).
General standard to be follow given in below image.
Note: make 9patch of those image which having uniform color and shape(not complex curve).
Upvotes: 6
Reputation: 56925
A 9 patch image is an image that has stretchable areas defined.
These areas are defined in a special 1 pixel wide border around the area. Add black pixels to the top and left of this border to describe where the image can be stretched horizontally and vertically.
Look Here for create nine patch image .
Upvotes: 1