What is the difference between the Mipmap directory and the drawable directory?

Source: Internet
Author: User

http://segmentfault.com/q/1010000002603418

There is no difference in use, you use it as a drawable.

However, using the MIPMAP system will provide some performance optimizations on the scale.

Official Introduction:

Mipmapping for Drawables

Using a mipmap as the source for your bitmap or drawable are a simple-to-provide a quality image and various image scal ES, which can is particularly useful if you expect your image to being scaled during an animation.

Android 4.2 (API level) added, mipmaps in the Bitmap class-android swaps the MIP images in your Bitmap when You ' ve supplied a mipmap source and has the enabled Sethasmipmap (). Now on Android 4.3, you can enable mipmaps for a Bitmapdrawable object as well, by providing a mipmap asset and setting th e android:mipmap attribute in a bitmap resource file or by calling Hasmipmap ().

Application Scenarios:

If you know so going to draw this bitmap at less than 50% of it original size, you could be able to obtain a high ER quality by turning. Note If the renderer respects this hint it might has to allocate extra memory-to-hold the mipmap-levels for this bit Map.

An application example:

Nexus 6

Screen
The Nexus 6 boasts an impressive 5.96 "Quad HD screens display at a resolution of 2560 x 1440 (493 ppi). This translates to ~ 730 x 410 DP (density independent pixels).

Check Your Assets
It has a quantized density of 560 dpi, which falls in between the xxhdpi and xxxhdpi primary density buckets. For the Nexus 6, the platformwould scale down xxxhdpi assets, but if those aren ' t available, then it'll scale u P xxhdpi assets.

Provide at least a XXXHDPI app icon because devices can display large app icons on the launcher. It ' s best practice to place your app icons in mipmap-folders (not the drawable-folders) because they is used at Resolut Ions different from the device's current density. For example, an XXXHDPI app icon can is used on the launcher for an xxhdpi device.

res/   mipmap-mdpi/      ic_launcher.png   mipmap-hdpi/      ic_launcher.png   mipmap-xhdpi/      ic_launcher.png     mipmap-xxhdpi/      ic_launcher.png   mipmap-xxxhdpi/         ic_launcher.png  # App icon used on Nexus 6 device launcher

Choosing to add xxxhdpi versions for the rest of your assets would provide a sharper visual experience on the Nexus 6, but Does increase apk size, so your should make a appropriate decision for your app.

res/   drawable-mdpi/      ic_sunny.png   drawable-hdpi/      ic_sunny.png   drawable-xhdpi/         ic_sunny.png   drawable-xxhdpi/  # Fall back to these if xxxhdpi versions aren’t available      ic_sunny.png    drawable-xxxhdpi/ # Higher resolution assets for Nexus 6      ic_sunny.png
Summarize

This example summarizes the following:

Nexus 6 has a 493 PPI, which is just between xxhdpi and xxxhdpi, so the display needs to reduce the resources of xxxhdpi, if you use mipmap-xxxhdpi, then there will be an optimization of sclae, better performance, less memory. So now the official recommended use of mipmap:

It ' s best practice to place your app icons in mipmap-folders (not the drawable-folders) because they is used at Resolut Ions different from the device's current density.

What is the difference between the Mipmap directory and the drawable directory?

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.