简体   繁体   English

Android资源 - 哪些分辨率应该进入hdpi,ldpi,mdpi和xhdpi目录

[英]Android Resources - which resolutions should go into the hdpi, ldpi, mdpi and xhdpi directories

I'm trying to write an application that will work well on all screen sizes, for that I have my graphic designer produce images that are in the requested dpis for each directory (Low density (120), ldpi, Medium density (160), mdpi, High density (240), hdpi, Extra high density (320), xhdpi) however, they want to know at which resolution and aspect ratio each image should be, after looking around the android documenation, namely: 1)http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources 2)http://developer.android.com/guide/practices/screens_support.html I came up with the following information: It is not exact that android supports 3 screen sizes, android is an OS that can run virtually on any screen size but there are some screen sizes that are more common than others, these are demonstrated in the table below (taken from http://developer.android.com/guide/practices/screens_support.html ) 我正在尝试编写一个适用于所有屏幕尺寸的应用程序,因为我让我的图形设计师为每个目录生成所请求的dpis图像(低密度(120),ldpi,中密度(160), mdpi,高密度(240),hdpi,超高密度(320),xhdpi)然而,他们想知道每个图像应该是哪个分辨率和宽高比,环顾android文档后,即:1)http:/ /developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources 2)http://developer.android.com/guide/practices/screens_support.html我想出了以下信息:它不是确切的说,Android支持3种屏幕尺寸,android是一款可以在任何屏幕尺寸上虚拟运行的操作系统,但有些屏幕尺寸比其他尺寸更常见,这些在下表中展示(取自http://developer.android) .com / guide / practices / screens_support.html

Table 1. Screen sizes and densities of emulator skins included in the Android SDK. 表1. Android SDK中包含的模拟器外观的屏幕大小和密度。 Low density (120), ldpi Medium density (160), mdpi High density (240), hdpi Extra high density (320), xhdpi Small screen QVGA (240x320) 低密度(120),ldpi中密度(160),mdpi高密度(240),hdpi超高密度(320),xhdpi小屏幕QVGA(240x320)
Normal screen WQVGA400 (240x400) WQVGA432 (240x432) HVGA (320x480) WVGA800 (480x800) WVGA854 (480x854) 普通屏幕WQVGA400(240x400)WQVGA432(240x432)HVGA(320x480)WVGA800(480x800)WVGA854(480x854)
Large screen WVGA800* (480x800) WVGA854* (480x854) 大屏幕WVGA800 *(480x800)WVGA854 *(480x854)
Extra Large screen 超大屏幕

It's worth noting here that even though it seems that there is no correlation between these screen sizes, there is a 3:4:6 scaling ratio between the three densities, so a 9x9 bitmap in ldpi is 12x12 in mdpi and 18x18 in hdpi (see http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources ). 值得注意的是,尽管这些屏幕尺寸之间似乎没有相关性,但三种密度之间存在3:4:6的缩放比例,因此ldpi中的9x9位图在mdpi中为12x12,在hdpi中为18x18(参见http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources )。

We can see some more information on what the screen sizes mean here: 我们可以在这里看到有关屏幕尺寸含义的更多信息:

Screen size • small: Screens based on the space available on a low-density QVGA screen. 屏幕尺寸•小:屏幕基于低密度QVGA屏幕上的可用空间。 Considering a portrait HVGA display, this has the same available width but less height—it is 3:4 vs. HVGA's 2:3 aspect ratio. 考虑到纵向HVGA显示器,它具有相同的可用宽度但较少的高度 - 与HVGA的2:3宽高比相比为3:4。 Examples are QVGA low density and VGA high density. 例子是QVGA低密度和VGA高密度。 • normal: Screens based on the traditional medium-density HVGA screen. •normal:基于传统中密度HVGA屏幕的屏幕。 A screen is considered to be normal if it is at least this size (independent of density) and not larger. 如果屏幕至少是这个尺寸(与密度无关)并且不大,则认为屏幕是正常的。 Examples of such screens a WQVGA low density, HVGA medium density, WVGA high density. 这种屏幕的例子是WQVGA低密度,HVGA中密度,WVGA高密度。 • large: Screens based on the space available on a medium-density VGA screen. •large:基于中密度VGA屏幕上可用空间的屏幕。 Such a screen has significantly more available space in both width and height than an HVGA display. 与HVGA显示器相比,这种屏幕在宽度和高度上具有明显更多的可用空间。 Examples are VGA and WVGA medium density screens. 例子是VGA和WVGA中密度屏幕。 • xlarge: Screens that are considerably larger than the traditional medium-density HVGA screen. •xlarge:比传统中密度HVGA屏幕大得多的屏幕。 In most cases, devices with extra large screens would be too large to carry in a pocket and would most likely be tablet-style devices. 在大多数情况下,具有超大屏幕的设备太大而无法放入口袋中,并且很可能是平板式设备。 Added in API Level 9. 在API级别9中添加。

We can also support specific aspect ratios, as defined here: 我们还可以支持特定的宽高比,如下所示:

Screen aspect • long: Long screens, such as WQVGA, WVGA, FWVGA • notlong: Not long screens, such as QVGA, HVGA, and VGA 屏幕方面•长:长屏幕,如WQVGA,WVGA,FWVGA•不长:不长的屏幕,如QVGA,HVGA和VGA

-- All of this however, is not enough to answer the simple question of what the resolution should be on those images - can they all be cut from the same high res image or should they be re-done for each dpi since the aspect ratio is different? - 然而,所有这些都不足以回答关于这些图像的分辨率应该是什么的简单问题 - 它们是否可以从相同的高分辨率图像中切割出来,或者是否应该为每个dpi重新制作,因为纵横比是不同的? please help, this is holding up my project Thanks! 请帮助,这是举起我的项目谢谢!

It depends on your images, really. 这取决于你的图像,真的。 Very tiny graphics you'll probably want to draw separately, since you're going to lose fine details when interpolating to smaller sizes, whereas with larger ones, you'll probably be fine just rescaling, starting with a high resolution image. 非常小的图形你可能想要单独绘制,因为当插入到较小的尺寸时你会丢失细节,而对于较大的图形,你可能会很好,只需重新缩放,从高分辨率图像开始。

For background images, that's always kind of a tricky one. 对于背景图像,这总是一种棘手的问题。 Since you can't count on a specific resolution, you can either estimate and go with one slightly smaller than the average, and turn it into a 9-patch, where the edges will stretch to cover the leftover space, or you can go with one slightly larger than the average (something like 900 x 500) and just make sure the edge area doesn't contain any pertinent information. 由于你不能指望一个特定的分辨率,你可以估计并选择略小于平均分辨率的分辨率,并将其转换为9补丁,其中边缘将拉伸以覆盖剩余空间,或者你可以选择一个略大于平均值(类似900 x 500)并确保边缘区域不包含任何相关信息。 Basically, think of it like a bleed for print, it's just extra area that may be cut off if the screen's not big enough. 基本上,把它想象成印刷的流血,如果屏幕不够大,它只是可能被切断的额外区域。 It's easier to just use some sort of gradient drawable or other resolution independent type of image for the background, if possible, due to the large number of different resolutions to support. 如果可能的话,由于需要支持大量不同的分辨率,因此更容易使用某种渐变可绘制或其他分辨率独立类型的图像作为背景。

When I'm creating graphics I considering this way: ldpi 240x320 mdpi 320x480 hdpi 480x800 xhdpi 800x1280 当我创建图形时,我考虑这种方式:ldpi 240x320 mdpi 320x480 hdpi 480x800 xhdpi 800x1280

Putting images separate drawable folders, drawable-hdpi, drawable-mdpi.... 将图像分成可绘制文件夹,drawable-hdpi,drawable-mdpi ....

Background is a bit tricky, you may do so with bg or even set it from your program not layout xml file. 背景有点棘手,您可以使用bg甚至从程序中设置它而不是布局xml文件。 That will provide you more flexibility, to chose weather you going to resize or crop it. 这将为您提供更大的灵活性,选择天气您将调整大小或裁剪它。

暂无
暂无

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

相关问题 ldpi、mdpi、hdpi 和 xhdpi 屏幕的背景应该是哪种尺寸? - Which size should a background be for ldpi, mdpi, hdpi and xhdpi screens? 显示密度和资源使用情况(ldpi / mdpi / hdpi / xhdpi) - display density and resources usage (ldpi/mdpi/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中所有ldpi,mdpi,hdpi,xhdpi的单个图像 - single image for all ldpi, mdpi, hdpi, xhdpi in android 如何在Android资产文件夹中保留hdpi,mdpi,ldpi和xhdpi文件? - How to keep hdpi,mdpi,ldpi and xhdpi files in the Android asset folder? 缩放ldpi,mdpi,hdpi和xhdpi的图像 - scale images for ldpi mdpi hdpi and xhdpi 如何在 mdpi、ldpi、hdpi、xhdpi 中调整图像大小 - How to resize image in mdpi, ldpi, hdpi, xhdpi Android屏幕大小为ldpi,mdpi,hdpi,xhdpi显示? - 例如:ldpi为1024X768像素 - android splash screen sizes for ldpi,mdpi, hdpi, xhdpi displays ? - eg : 1024X768 pixels for ldpi 为什么Android以错误的顺序寻找QVGA资源mdpi> hdpi> ldpi? - Why is Android looking for QVGA resources in the wrong order mdpi > hdpi > ldpi? 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