In the process of Android development, we often because there is no good graphic image distortion, so that the interface looks inferior to many, sometimes we would like to drawable-hdpi,ldpi,mdpi in the image of different resolution, so that although it can effectively avoid image distortion, But such a problem is a picture resource-like whole project too big. So sometimes we want to be some pictures can stretch without losing a lot of good ah, this time we will think of Android for us to provide the 9.png format of the picture, the 9.png format image is an Android platform on the new creation of a stretch but the real thing.
Learned the production of this 9PNG picture, we later do the project when some because of different resolution and distorted picture can be used this way, the following look at its production process.
9PNG Production Tools We do not need to download, because the Android SDK has brought this tool, in the tools directory to find Draw9patch.bat, double-click will appear as shown:
Then drag the picture we want to make directly to the tool above, and it will appear like the following figure:
Put the mouse on a white border, click the left button do not put drag, will appear black line as shown:
Number 1th, the area to the right of the black strip where the picture is stretched vertically, only the area is stretched
Number 2nd the area covered by the black strip indicates that when the picture is stretched horizontally, only the area is stretched
The area of the 3rd black strip position to the left covers the area where the picture is displayed vertically (the main text area on the phone)
The area of the 4th black strip where the position is covered up indicates the area where the picture is displayed horizontally (mainly the text area on the phone)
The area covered with no black bar is the picture is stretched to remain unchanged (for example, if the four corners of the picture are curved, when the picture is arbitrarily stretched, the four corners of the arc will not change)
3 Red graphics area to the right to display the current stretch effect
Select a good area, click on the left file-"save 9-path, save the picture, suffix named Xxx.9.png." This makes it a success, and then you can throw this picture into the corresponding directory in drawable-hdpi.