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. Nine patch images are especially useful when designing buttons. Custom drawn buttons can look distorted and pixelated when their borders are stretched in addition to the rest of the image.

Procedure To Create:-

Making a 9 Patch image is a fairly easy process.Included as part of the Android SDK is a Draw 9 Patch utility. Navigate to the folder where you installed the SDK. From there navigate to the tools folder. Inside this folder will be the draw 9 patch program. On Windows, double click on draw9patch.bat

 

 

Once the Draw 9 Patch program has started, simply drag an image that you would like to edit onto the program.

 

 

After an image has been loaded into the Draw 9-Patch program two panes of information will appear. The left pane is used to edit the patches. The right pane shows what the image will look like when it is stretched in a couple of different ways.

 

 

You can think of the Draw 9 Patch program as a simple image editor, but you can only change the 1 pixel border and you can only use the color black.

Drawing the Patches

Draw along the top of the image to define the area that can be stretched horizontally.

Draw along the left side of the image to define the area that can be stretched vertically.

Draw along the bottom and the right of the image to define the padding.

Holding down shift and clicking will erase pixels.If you have the “Show Patches” option selected, then the stretchable area will be highlighted in pink.

 

 

 

Post By:- Manish Verma