简体   繁体   English

Android中所有ldpi,mdpi,hdpi,xhdpi的单个图像

[英]single image for all ldpi, mdpi, hdpi, xhdpi in android

Perhaps we use one image for all ldpi, hdpi, mdpi and xdpi where we need to keep the image(in which folder). 也许我们对所有ldpi,hdpi,mdpi和xdpi使用一张图像,而我们需要将该图像保存在哪个文件夹中。 This is a bit confusion to me. 这对我来说有点混乱。 Can anybody clarify my confusion? 谁能澄清我的困惑?

只需将其保存在res/drawable

This is not recommended as the images you use will then not scale well for different device screen sizes. 不建议这样做,因为您使用的图像对于不同的设备屏幕尺寸将无法很好地缩放。 But if you place an image in res/drawable this will work. 但是,如果将图像放置在res/drawable它将起作用。

Instead of creating all of the different folder buckets, drawable-ldpi , drawable-hdpi , etc. Just create one folder, drawable , and then put your images in there and when Android searchs for the image and doesn't find the other folders it will default to the drawable folder as the only resource. 无需创建所有不同的文件夹存储桶,而是drawable-ldpidrawable-hdpi等。只需创建一个文件夹drawable ,然后将图像放在其中,当Android搜索图像而找不到其他文件夹时,将默认为drawable文件夹作为唯一资源。 This folder is understood by Android to be equal to the drawable-mdpi and will scale the images accordingly. Android将此文件夹理解为等于drawable-mdpi ,并将相应缩放图像。

EDIT: Also available is the res/drawable-nodpi , This will not scale your image at all and it will retain the same size on all screens. 编辑: res/drawable-nodpi也可用,这根本不会缩放图像,并且在所有屏幕上都将保持相同大小。

Take a look at How to Support Multiple Screens 看看如何支持多个屏幕

The "default" resources are those that are not tagged with a configuration qualifier. “默认”资源是那些没有用配置限定符标记的资源。 For example, the resources in drawable/ are the default drawable resources. 例如,drawable /中的资源是默认的drawable资源。 The system assumes that default resources are designed for the baseline screen size and density, which is a normal screen size and a medium density. 系统假定默认资源是为基线屏幕尺寸和密度(正常屏幕尺寸和中等密度)设计的。 As such, the system scales default density resources up for high-density screens and down for low-density screens, as appropriate. 这样,系统会适当地按比例将默认密度资源扩大到高密度屏幕,并缩小到低密度屏幕。

So yes, drawable folder is what you are looking for. 所以是的,drawable文件夹正是您要的东西。

暂无
暂无

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

相关问题 如何在 mdpi、ldpi、hdpi、xhdpi 中调整图像大小 - How to resize image in mdpi, ldpi, hdpi, xhdpi 有没有办法创建一个图像(而不是4具有不同的分辨率ldpi,mdpi,hdpi和xhdpi)并用于所有的Android设备分辨率? - Is there any way to create one image(Instead of 4 with different resolutions ldpi,mdpi,hdpi and xhdpi) and use for all the android device resolutions? 如何在Android资产文件夹中保留hdpi,mdpi,ldpi和xhdpi文件? - How to keep hdpi,mdpi,ldpi and xhdpi files in the Android asset folder? 图像大小(drawable-hdpi/ldpi/mdpi/xhdpi) - image size (drawable-hdpi/ldpi/mdpi/xhdpi) android调整所有屏幕(ldpi,mdpi,hdpi,xhdpi)的图像大小并放入文件夹 - android resizing images for all screens (ldpi,mdpi,hdpi,xhdpi) and put in folders 缩放ldpi,mdpi,hdpi和xhdpi的图像 - scale images for ldpi mdpi hdpi and xhdpi Android屏幕大小为ldpi,mdpi,hdpi,xhdpi显示? - 例如:ldpi为1024X768像素 - android splash screen sizes for ldpi,mdpi, hdpi, xhdpi displays ? - eg : 1024X768 pixels for ldpi Android资源 - 哪些分辨率应该进入hdpi,ldpi,mdpi和xhdpi目录 - Android Resources - which resolutions should go into the hdpi, ldpi, mdpi and xhdpi directories 有没有办法从大型图像创建 xxhdpi、xhdpi、hdpi、mdpi 和 ldpi 可绘制对象? - Is there a way to create xxhdpi, xhdpi, hdpi, mdpi and ldpi drawables from a large scale image? android如何缩放可绘制对象? 如果我有xhdpi,hdpi,mdpi但没有ldpi? - How android scales drawables? If I have xhdpi, hdpi, mdpi but don't have ldpi?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM