Do the project today, the footage has some problems, and then the boss told me about the android image format below. 9.png and draw 9-patch use, feel very clear also very useful, so record.
About 9-patch I won't say a lot of it on the Internet. The following is a little bit of my experience with the Android project to understand its role.
First, let's look at the project resource list:
Okay, this file folder has my project resources in place.
So, you see, there is a pattern in the picture: all the suffixes are. 9.png pictures have black edges, and. png pictures are normal.
Open it with the picture browser and see:
This is the normal picture (magnified a lot)
This is the 9.png picture
As you can see, the 9.png picture has black lines around it.
Why is this? I did not know before, anyway use ~
But when I do something today in the New button to set the background used in the previous resource map, and then the button inside the font is not complete, I feel strange, want to know what the next figure is going on.
Well, the problem of the picture is not cut, because I can not intercept at home, of course, this is not the point.
The Draw 9-patch tool is not introduced and opens directly. The path is under the Tools folder under ANDROIDSDK.
My path is/home/rossoneri/document/android/android-sdk-linux/tools (under Ubuntu)
Increase the executable permissions of the file first after opening with terminal chmod +x
Then you can open it directly.
You can see the program when you open it:
Then we drag a 9.png image into it:
OK, here's a clear look, there are four black lines around, and all of them are displayed in pixels of one pixel. The image on the left is the current picture, and the right side is set by the current setting: longitudinal stretch, transverse stretch, horizontal stretch. If Show content is selected, the inside of the right side will have a block:
This block represents the text within the image of the display range, such as the picture used on the button, the button on the text will be filled in the box, if the block is too small, then the text can not be displayed completely. That's the situation I met.
Well, the rest is the focus, the 4 black lines on the left are what they are for.
I'll think about it first, it's too late to go to bed, tomorrow night.
Oh, here's a little bit about Ubuntu. First you can press the PRTSC key directly, of course, this section is the entire screen.
There is another way, CTRL+SHIFT+PRTSC, which can be free, but the cut figure needs to be pasted in the picture editor.
I recommend is SHIFT+PRTSC, free, cut off directly pop-up Save dialog box, very convenient to say (ubuntu14.04)
[Novice to] Android Fix drawing tool draw 9-patch use summary (with Ubuntu Quick Method)