简体   繁体   English

Drawable-hdpi,Drawable-mdpi,Drawable-ldpi Android

[英]Drawable-hdpi, Drawable-mdpi, Drawable-ldpi Android

I was working on Android 1.5, but I have now moved to the latest version. 我正在使用Android 1.5,但我现在已经转移到了最新版本。 So there is only one "drawable" folder in Android 1.5, but now there are three different folders for storing images in the Android project. 因此Android 1.5中只有一个“drawable”文件夹,但现在有三个不同的文件夹用于在Android项目中存储图像。

And I have found some articles for these three folders that says 我发现这三个文件夹的一些文章说

  1. hdpi means High-dpi hdpi表示高dpi
  2. mdpi means medium-dpi mdpi表示中等dpi
  3. ldpi means low-dpi ldpi表示低dpi

But what is the exact purpose of these three folders and when should I use a particular folder to store images in? 但这三个文件夹的确切目的是什么?我应该何时使用特定文件夹存储图像?

To declare different layouts and bitmaps you'd like to use for the different screens, you must place these alternative resources in separate directories/folders. 要声明要用于不同屏幕的不同布局和位图,必须将这些备用资源放在单独的目录/文件夹中。

This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi , 100x100 for mdpi , and 75x75 for ldpi devices. 这意味着如果为xhdpi设备生成200x200映像,则应在150x150hdpi生成相同的资源,为mdpi生成100x100 ,为ldpi设备75x75 ldpi

Then, place the files in the appropriate drawable resource directory: 然后,将文件放在适当的drawable资源目录中:

MyProject/
    res/
        drawable-xhdpi/
            awesomeimage.png
        drawable-hdpi/
            awesomeimage.png
        drawable-mdpi/
            awesomeimage.png
        drawable-ldpi/
            awesomeimage.png

Any time you reference @drawable/awesomeimage , the system selects the appropriate bitmap based on the screen's density. @drawable/awesomeimage引用@drawable/awesomeimage ,系统都会根据屏幕的密度选择合适的位图。

I got one good solution. 我有一个很好的解决方案。 Here I have attached it as the image below. 在这里,我将其附加为下图。 So try it. 试试吧。 It may be helpful to you...! 它可能对你有帮助......!

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android:Drawable-hdpi,Drawable-mdpi,Drawable-ldpi? - Android : Drawable-hdpi, Drawable-mdpi, Drawable-ldpi? 解释drawable,drawable-ldpi,drawable-mdpi和drawable-hdpi之间的区别 - Explain the difference between drawable, drawable-ldpi, drawable-mdpi and drawable-hdpi 如何使用res文件夹的drawable-hdpi,drawable-mdpi,drawable-ldpi中存在的图像? - how to use images present in drawable-hdpi,drawable-mdpi,drawable-ldpi of res folder? drawable与drawable-ldpi / drawable-mdpi - drawable vs. drawable-ldpi/drawable-mdpi 我对drawable-hdpi和drawable-mdpi很困惑 - I am confused with drawable-hdpi and drawable-mdpi 创建新的Android Studio项目,但不包含drawable-ldpi,drawable-mdpi等 - New Android Studio project created without drawable-ldpi,drawable-mdpi etc 其中drawable-hdpi,drawable-mdpi,drawable-xhdpi和drawable-xxhdpi。 走? - where drawable-hdpi ,drawable-mdpi ,drawable-xhdpi and drawable-xxhdpi. go? 图像大小(drawable-hdpi/ldpi/mdpi/xhdpi) - image size (drawable-hdpi/ldpi/mdpi/xhdpi) Android结合使用drawable和drawable-mdpi,ldpi等 - Android using mix of drawable and drawable-mdpi, ldpi etc 我是否需要使用所有drawable,drawable-mdpi,drawable-hdpi,drawable-xhdpi,drawable-xxhdpi和drawable-xxxhdpi? - Do I need to use all of drawable, drawable-mdpi, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi & drawable-xxxhdpi?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM