This article discusses the following two topics around the .9.png format:
1. Features of the image in this format
2. Production Method
Features of a .9.png File
Compared with a traditional PNG image, a 9.png image consists of an edge of one pixel around the image. This edge is used to define the expandable exhibition area and content display area of the image.
Images in this format can be adjusted automatically in the android environment.
(1) allow developers to defineScalable AreaWhen you want to extend an image to a greater area than the image itself, the content of the expanded area is extended.
(2) allow developers to defineContent display areaTo display text or other content.
As shown in:
The black lines on the left and above can be expanded.
The black line on the right and bottom is the content display area.
Ii. Create a .9.png Image
The Tools Folder of Android SDK provides tools for creating images in this format.Draw9patch. bat
Use this tool to open any image and place the cursor over the image. The main interface is shown in:
The area covered in black is uneditable (locked), and the edge of a pixel around it is editable.
Press and hold the left mouse button to draw a scalable exhibition area on the left and top sides.
Draw the content display area on the right and bottom. The result is as follows:
After the painting is complete, select File-> Save to save the file in .9.png format and use it in the android project.