Why Android should load different picture files according to the screen resolution

Source: Internet
Author: User

1. Picture in xxhdpi, cell phone is hdpi

We have a cell phone that is hdpi. We also have a picture, we put him under the xxhdpi. When the phone is displayed, the system will go to hdpi, found no pictures, and eventually found in the XXHPI. Finally found the picture, the system will feel xxhdpi in the picture must be very large, and I want to show it in HDPI's mobile phone should be compressed, eventually become the original 1/4, and the compressed picture will lose something, it will cause a vague situation. Such a disadvantage is also obvious, showing that the image of the mobile phone is reduced in clarity, a lot of blur.

2. Picture at DPI, phone is hdpi

The system went to hdpi first, did not find, eventually found in the DPI. The system then loads it into memory and stretches it proportionally before it is loaded into memory. There is no problem when stretching and then showing the sharpness to the phone, but the memory footprint is up to 4 times times the original!

Q: What is the difference in memory consumption when using the same set of DPI resources on different phones? Or how is the memory consumption of resources in the App loaded in different DPI folders different?

a: do not use a set of resources for different DPI devices, so the clarity of the picture and memory consumption will be problematic . This is why Android requires different resources for different DPI files, and the aspect ratio of different DPI resources should correspond to DPI ratio.

So we need to prepare different resource images for different resolutions!

Reference from:

http://www.tinylab.org/android-loading-a-different-relationship-between-dpi-and-memory-consumption-of-resources/

Why Android should load different picture files according to the screen resolution

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.