Android drawable-hdpi、drawable-ldpi、drawable-mdpi、drawable-xhdpi和drawable-xxhdpi是什么意思

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20071887/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:17:16  来源:igfitidea点击:

What is the meaning of drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpi

android

提问by shaby

I am really confused What is the significance of drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpi of android drawable type under res and how to decide which one of them sholud use?

我真的很困惑res下android drawable类型的drawable-hdpi,drawable-ldpi,drawable-mdpi,drawable-xhdpi和drawable-xxhdpi的意义是什么,如何决定使用其中的哪一个?

回答by krishna

ldpi    Resources for low-density (ldpi) screens (~120dpi).
mdpi    Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi    Resources for high-density (hdpi) screens (~240dpi).
xhdpi   Resources for extra high-density (xhdpi) screens (~320dpi).
nodpi   Resources for all densities. These are density-independent resources. The system does not scale resources tagged with this qualifier, regardless of the current screen's density.
tvdpi   Resources for screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. If you find it necessary to provide tvdpi resources, you should size them at a factor of 1.33*mdpi. For example, a 100px x 100px image for mdpi screens should be 133px x 133px for tvdpi.

So when you create drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpithe phone appropriately takes the resources according to its pixel density.If nothing is specified it will take resources from drawable. For more details check here

因此,当您创建drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpi手机时,根据其像素密度适当地获取资源。如果未指定任何内容,它将从drawable. 有关更多详细信息,请查看此处

回答by Hamad

these are image folders for different densities.

这些是不同密度的图像文件夹。

hdpiimages for the Android Broad Screen set or Android Phones with the Higher resolution.

hdpi适用于 Android 宽屏设备或具有更高分辨率的 Android 手机的图像。

ldpiLower images quality supported by the earlier sets of the android

ldpi早期版本的 android 支持的图像质量较低

mdpifor medium images support

mdpi对于中等图像支持

xhdidevices with maximum resolution.

xhdi具有最大分辨率的设备。

回答by Tofeeq Ahmad

Android categories device on two bases

基于两个基础的 Android 类别设备

  • Resolution which xlarge,sw800dp etc. (Mainly for Layout folder)
  • Base on the DPI which is main point to Image that is handle in drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpi
  • xlarge,sw800dp 等的分辨率(主要针对 Layout 文件夹)
  • 基于 DPI,它是在drawable-hdpi、drawable-ldpi、drawable-mdpi、drawable-xhdpi 和 drawable-xxhdpi 中处理的图像的主要点

More Explanation

更多解释

My HTC explorerscreen comes under small screen, but because of high density pixel per inch it take image from drawable-hdpi. Samsung Tabwith 10 inch screen comes under large screen category but take images from drawable-mdpi.

我的HTC explorer屏幕属于小屏幕,但由于每英寸高密度像素,它从drawable-hdpi获取图像。Samsung Tab10 英寸屏幕属于大屏幕类别,但从drawable-mdpi获取图像。

回答by Ricardo

These are used to put images of different resolutions to address devices' different screen sizes. For more information, check: http://developer.android.com/guide/practices/screens_support.html

这些用于放置不同分辨率的图像以解决设备的不同屏幕尺寸。有关更多信息,请查看:http: //developer.android.com/guide/practices/screens_support.html

回答by Voidpaw

These folders allow you to store multiple different quality versions of a picture so that faster phone can show a better quality picture while an older, slower phone still allows the app to run, albeit with lower quality pictures. It also depends heavily on the DPI of your phone which one it uses. If you want more information you can read up on it on This website (developer.android).

这些文件夹允许您存储图片的多个不同质量版本,以便速度更快的手机可以显示质量更好的图片,而较旧、速度较慢的手机仍然允许应用程序运行,尽管图片质量较低。它还在很大程度上取决于您手机使用的 DPI。如果您想了解更多信息,可以在本网站 (developer.android) 上阅读