Standard method for making 9patch images

Source: Internet
Author: User

9patch picture making tools in Sdk\tools\draw9patch.bat

By drawing a point or line on the left side of a picture to control the vertical and horizontal stretching of the picture, we make sure that the area and the line corresponding to the point are stretched without affecting the image effect after we draw the point or line. How can we guarantee it? The simple one is that the area of the plotted point and line corresponds to a solid color area.


Determines its content display area by drawing a line to the right and bottom of a picture. The right draw line determines the toppadding and bottompadding of the picture, and the bottom line determines the leftpadding and rightpadding of the picture. This is the same effect as defining the padding value in the layout file. Of course, the way to draw padding directly in the picture is better.

Here are some examples:



When the image is horizontally or vertically stretched, it automatically stretches its corners so that the image is deformed.

We have a little bit on the top and left of it. This way, when stretched, only the area that corresponds to the point is stretched. Generally we only use on the top and left point one point is enough.

But in special cases, we may need to draw a line in segments. For example, there is content in the picture, we are going to draw the line according to proportion to determine the stretching area.



See how this is determined for the stretch area. The top point 4 points, is used to determine the "open", "off" two words are located in the relative position of the picture. Ensure that the horizontal stretch is still the same position.

One point on the left, we can only point at the white space and let it stretch vertically, and stretch the blank pixels. Does not affect the effect.



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Standard method for making 9patch images

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.