9-patch image usage in android,

Source: Internet
Author: User

9-patch image usage in android,

In many articles, 9.png has two areas: a scalable exhibition area and a content display area. It took only half a day to understand what is a scalable exhibition area and a content display area.

Share your understanding.

Is a blog:

Picture from: http://blog.csdn.net/greatstar/article/details/5936177


A 9.png image has four black lines or black spots on the top, bottom, and left. The general understanding is:

Line above: Area horizontally stretched.

Line on the left: vertical stretch area.

The line on the right and bottom shows the content display area and editable area. It is the area where the control is placed. Except for this area, nothing else can be placed.

For example:


<TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: background = "@ drawable/tt" android: text = "this is a test. "/>

If you move the line to the right to see the effect:

The text is displayed in the area on the right and bottom. (Here Is text. If other controls such as button are added, the text is also displayed here)

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.