In Android, you can not only use normal images with the. png,.jpg,.gif extension as a picture resource, but you can also use a 9-patch image with a. 9.png extension as a picture resource. Normal images with the extension. Png,.jpg,.gif are common, and they are usually done by drawing software. The 9-patch picture is generated by using the tools provided in the Android SDK for draw 9-patch. So why use 9-patch this kind of picture? The reason is: unlike normal pictures, when using the 9-patch image as the background of the screen or button, when the size of the screen or button changes, the image can be automatically scaled to achieve the effect of non-distortion.
Here's how to use the tool draw 9-patch: (most of it is quoted from Network http://blog.csdn.net/jamin0107/article/details/6828975/)
1. The tool is located in the Tools directory under the installation directory of the Android SDK and is named Draw9patch.bat. As shown in the following:
2. Double-click Draw9patch.bat to open the software as shown in:
3.file/open 9-patch ... Open an original picture (normal picture) as shown in:
4. You will find that there is no transparent area of the picture around the appearance of a pixel of space, this gap is for the. 9 picture is underlined. Next, we underline the picture in the left and right. where the upper and left lines are controlled by the picture's stretchable area (two-line intersection area) , that is , the upper line control picture "letter" word transverse can be stretched, the left side of the line control longitudinal can be stretched. the lines below and the lines on the right control the text area of the picture, that is, if there is text on the picture, the position is controlled in the area below and to the right of the line siege.
5. If you want to remove the dash in a pixel-operable area, right-click on the black line or hold down SHIFT + left mouse button.
6. Display the effect. Draw9patch tool, there will be three pictures on the right side: the first one for the left side of the vertical stretch of the line, the second for the upper line produced by the transverse stretch, the third one for the horizontal longitudinal stretch. As shown in the following:
7. Save. File/save 9-patch ... Save processing completed. 9.png to Local.
Understanding of 9-patch images in Android