ZZ Error:9-patch image xx. 9.png Malformed

Source: Internet
Author: User

http://blog.csdn.net/msn465780/article/details/50072945

Http://www.cnblogs.com/loulijun/archive/2011/12/22/2298087.html

http://blog.csdn.net/aaawqqq/article/details/50786712

2) Reason:

Error message: No marked region found along edge. (The AAPT tool cannot confirm the stretch area in the 9-patch picture)

Because making the Android 9-patch picture (for example)

The picture was only marked with a vertical stretch (left) area, without marking the horizontal stretch (upper) area,

Therefore AAPT cannot confirm the stretch area in the 9-patch image.

9-patch pictures (. 9.png) If you want to take effect, you need to have horizontal and vertical edge marking area (left & top)

Related 9-patch Production reference:

Http://www.cnblogs.com/loulijun/archive/2011/12/22/2298087.html

There's a lot of crap about that. 9.png pictures have been a long time, simply record them down, in case later forget. Although there are many online, but very messy, looking upset, and not in line with their own needs, so still own hands and clothing.

The. 9.png picture is actually a PNG format picture, but it is more than the normal PNG image outside the 1px (pixel) border, the other is the use of this format of the picture can achieve the background adaptive size and without losing the real effect. For example, some controls after the screen switch after the appearance of the control is distorted, or some of the picture as the control background is also distorted, which makes people very depressed. Fortunately, the 9.png picture can provide these required features

Use steps

1, make your own PNG picture, must be a PNG image. Can own PS production, also can unzip other application apk file, with the picture resources inside, Android system also have picture resources can use ()

2 . Locate the draw9patch.bat file in the D:\android\android-sdk-windows\tools directory, then open it and drag the PNG image you want to process. or file-to-Open 9 patch

Upper black line: Transverse stretch area, must be drawn, stretching is transverse stretching, as the right area the second stretch is the effect of transverse stretching

Left black line: The longitudinal stretch of the area, must be drawn, stretching is a longitudinal stretch, such as the right area the first stretch is the effect of a longitudinal stretch

Black line below: Optional, horizontal content display area

Right black line: optional, vertical content display area

The rest of you try it out.

3, Note that the black line must be continuous, if you feel bad painting, press shift+ the left mouse button to wipe it out, and then new painting. After painting click File-->save 9-patch Save, effect such as

4, the next need to use in the program, the picture can be put into the drawable, and other pictures use no difference, the only magic is adaptive, not distortion

For example, we use this image to define a button, plus a textview background image, also. 9.png picture.

Main.xml

 <?xml version= "1.0" encoding= "Utf-8"? 
<linearlayout xmlns:android= "http://schemas.android.com/ Apk/res/android "
android:layout_width=" fill_parent "
android:layout_height=" fill_parent "
Android:paddi ng= "6DP"
android:orientation= "vertical";

<textview
android:layout_gravity= "right"
Android:layout_width= "Wrap_content"
android:layout_height= "wrap_content"
android:padding= " 5DP "
android:background=" @drawable/sms_out_normal_bg "
android:text=" http://www.cnblogs.com/loulijun/ \ n--Hwarang "/>

<button
android:id=" @+id/sendmsg "
android:layout_width=" Wrap_cont Ent "
android:layout_height=" wrap_content "
android:layout_gravity=" center "
Android:padding = "10DP"
android:background= "@drawable/test"
android:text= "send Message to Child"
/>
</linearla Yout>

The results are as follows:

ZZ Error:9-patch image xx. 9.png Malformed

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.