I would like to know why do we use nine-patch ? I know is to shrink or stretch images but if I want to resize an image can\'t we just do it on a dedicated image editor like
The advantage of using 9-patch images is that when using it as a background, for instance, the image won't stretch and loose proportions in different screen sizes. the center 'patch' will remain as is and the 'borders' patches will be stretched to fit the screen/view size.
one more and biggest advantage is memory. Same small size memory can be reused for different screen size devices.Well-designed 9-patch images are less error-prone and have high reusability. I had hard time optimizing the UI for different resolutions until I knew that Android supports 9-patch.
For padding as @hotveryspicy said you can use the padding box ( where your text button will be filled) to define your paddig values and they are defined like this:
Hope this will help you to have a clear idea and how important 9-patch drawable are
Nine-patch allow you to strech just a part of an image, and not the whole image. It can be useful to design for example custom buttons, EditTexts, etc...
You can lean more here: http://developer.android.com/tools/help/draw9patch.html