Search code examples
androidnine-patch

9 patch shows nothing on open


I am learning 9 patch in Android but when I open I am just getting below image.

enter image description here

Now I am confused on how to start the 9 patch as nothing is present here to start.


Solution

  • You must open an existing file (this is not a DRAWING program).

    To create a button image. either:

    • use Google/Images/select some you like
    • make some in Paint/Gimp/PhotoShop
    • or take them from the android SDK

    The choice is broad.

    The rest of the process is trivial:

    • add a 1px border on each side of your picture
    • add the black pixels (up and left side to set the stretchable area/s, right and bottom sides to set the padding - mostly used for keeping the text evenly spaced from the boundaries)
    • save the file as my_file.9.png (.9.png!)
    • drag'n'drop it into the tool to adjust it