Editing 9-patch PNG files
The last of my mini guides will give you a rough idea on how to edit those pesky blah.9.png files you come across sometimes in apks.
First you will need to decompile the apk using apktool if you open the blah.9.png file now in an image editor you will notice a weird border is along the outside of the image of black pixels. Those are normal and are there for a reason.
Consulting the android documentation you find this:
So these png images are scaled which is why when you try to manually edit them they look like blown out poop because you don't set the 9-patch up correctly. Well LET'S DO IT RIGHT THIS TIME. Edit the inside of your 9-patch png and put whatever you want inside it.
NOTE: the outside border around the image of 1 pixel is used for 9-patch so don't bother putting anything inside there it will break things
Now take your png file and you're going to use the Draw 9-patch utility to modify the 9-patch. This program (draw9) is included in the andrdoid sdk and is invoked just by typing draw9. Once it launches you can drag & drop a 9-patch png to begin working. Rather than reinvent the wheel to explain how 9-patch works reference this thread as it explains it quite well:
anddev.org • View topic - Tutorial: Buttons with (niceley) stretched background
So after you are done making your 9-patch use apktool to rebuild your apk. Decompress the apk inside the dist folder and copy the newly created blah.9.png into a unzipped copy of your apk. Rezip like you would replacing any image and your new 9-patch PNG should be in your theme!
Click to expand...