Four types of PNG images used in Android

Source: Internet
Author: User

There can be four types of image files suffixed with PNG in Android.

1. Standard PNG: (ex.application icon.png)

Meet the PNG-8 standard PNG pictures, can only do pictures, can not shrink.

2.9.png behind Android packaging: (ex. 9.pngpackaged in app apk)

To ensure a small footprint, Android deletes a large amount of redundant information from standard PNG in resources, removes the surrounding white pixels, and reduces the idat data segment.,

When the package is made into apk, the corresponding file 9.png cannot be scaled. Although the extension is still 9.pngNo scale-down Function,And remove two pixels with more Boundary.

3.android9.png:

You can find the 9.png image in drawable, but an error will be reported when you use the draw 9-patch software, but it can be used in drawable,

These files only delete redundant information and add two pixels at the boundary,

No printable flag is added to the file. These files can only be used as the 9. PNG package (but the size is smaller) and cannot be scaled down or set as the background.

4.androidscalable 9.png:

You can use the draw 9-patch software to enable it. There is no error. It is used in drawable and Android will scale down Based on the set black pixel.

You can add a scalable flag to a file, which can be used as a view background or a common image display. You can stretch and scale the background.

When setting a non-background image, for example, a SRC image such as imageview does not change with the view. The image is displayed in part or whole according to its own size.

 

In addition, the parsing logic of the 9.png suffix file and the logic of the chunk check that can be scaled down images. cpp

9. PNG judgment function entry: "nine-patch" field judgment in drawable. Java

Related Article

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.