Android xxx-hdpi 真机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21452353/
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
Android xxx-hdpi real devices
提问by j.c
I'm gonna release my app, it's a 1.2Mb apk that includes about 120 icons in 4 different formats (ldpi, mdpi, hdpi, x-hdpi).
我要发布我的应用程序,它是一个 1.2Mb 的 apk,其中包含 4 种不同格式(ldpi、mdpi、hdpi、x-hdpi)的大约 120 个图标。
If I add xx-dpi and xxx-hdpi icons the apk grows bigger and loading time increases.
There are many entry-level devices out there with really loooow memory and I'd like my app to run everywhere.
如果我添加 xx-dpi 和 xxx-hdpi 图标,apk 会变大,加载时间也会增加。
有许多入门级设备的内存非常低,我希望我的应用程序可以在任何地方运行。
Do I really need to add xx-hdpi?
我真的需要添加 xx-hdpi 吗?
And is there a real device that requires xxx-hdpi?
是否有需要xxx-hdpi的真实设备?
回答by John
You shouldn't really need xxxhdpi
. It was only introduced because of the way that launcher icons are scaled on the nexus 5's launcher
你不应该真的需要xxxhdpi
. 引入它只是因为在 nexus 5 的启动器上缩放启动器图标的方式
EditBack when I answered in Jan 2014, the Nexus 5 was the only device using xxxhdpi
. Now many devices including the Nexus 6 and LG G3 use it. So it would be a good idea to include it in your app.
当我在 2014 年 1 月回答时,请编辑回来,Nexus 5 是唯一使用xxxhdpi
. 现在包括 Nexus 6 和 LG G3 在内的许多设备都使用它。因此,将它包含在您的应用程序中是个好主意。
回答by ToddH
We had to add xxxhdpi to our app for the Nexus 6, LG G3, and Samsung Galaxy Note 4. There will be more xxxdhpi devices in the future.
我们必须将 xxxhdpi 添加到我们的 Nexus 6、LG G3 和三星 Galaxy Note 4 应用程序中。将来会有更多 xxxdhpi 设备。
回答by Matt Quigley
You do notneed xxxhpdi for most of your images. You only need xxxhdpi for your launcher icon. Please see http://developer.android.com/guide/practices/screens_support.html
你不是需要xxxhpdi对于大部分的图像。您的启动器图标只需要 xxxhdpi。请参阅http://developer.android.com/guide/practices/screens_support.html
You should not use the xxxhdpi qualifier for UI elements other than the launcher icon.
您不应将 xxxhdpi 限定符用于启动器图标以外的 UI 元素。
It's pretty clear in the above quote. In the example folder layout they give, they show all the densities for the res/drawable
folders up to -xxhdpi
, but then they show the res/mipmap
folders up to -xxxhdpi
. Here are more quotes:
在上面的引文中很清楚。在他们给出的示例文件夹布局中,他们显示了res/drawable
文件夹的所有密度-xxhdpi
,但随后他们显示了res/mipmap
文件夹的密度-xxxhdpi
。这里有更多的报价:
xxxhdpi
Resources for extra-extra-extra-high-density (xxxhdpi) uses (~640dpi). Use this for the launcher icon only, see note above.The
mipmap-xxxhdpi
qualifier is necessary only to provide a launcher icon that can appear larger than usual on an xxhdpi device. You do not need to provide xxxhdpi assets for all your app's images.
xxxhdpi
用于超超超高密度 (xxxhdpi) 用途的资源 (~640dpi)。仅将此用于启动器图标,请参阅上面的注释。所述
mipmap-xxxhdpi
限定词仅需要提供一种能够显示比通常大的xxhdpi设备上的启动器图标。您不需要为所有应用程序的图像提供 xxxhdpi 资产。
回答by Marcin Bauer
You don't need ldpi, because Android downsizes hdpi to ldpi.
您不需要 ldpi,因为 Android 将 hdpi 缩小为 ldpi。
From https://developer.android.com/design/style/iconography.html
来自https://developer.android.com/design/style/iconography.html
Note: Android also supports low-density (LDPI) screens, but you normally don't need to create custom assets at this size because Android effectively down-scales your HDPI assets by 1/2 to match the expected size.
注意:Android 还支持低密度 (LDPI) 屏幕,但您通常不需要创建此尺寸的自定义资产,因为 Android 有效地将 HDPI 资产缩小了 1/2 以匹配预期尺寸。
回答by ygbr
From Android iconography documentation itself:
来自 Android 图标文档本身:
Some devices scale-up the launcher icon by as much as 25%. For example, if your highest density launcher icon image is already extra-extra-high density, the scaling process will make it appear less crisp. So you should provide a higher density launcher icon in the drawable-xxxhdpi directory, which the system uses instead of scaling up a smaller version of the icon.
某些设备将启动器图标放大 25%。例如,如果您的最高密度启动器图标图像已经是超高密度,则缩放过程会使其看起来不那么清晰。所以你应该在 drawable-xxxhdpi 目录中提供一个更高密度的启动器图标,系统使用它而不是放大一个较小版本的图标。
Note: the drawable-xxxhdpi qualifier is necessary only to provide a launcher icon that can appear larger than usual on an xxhdpi device. You do not need to provide xxxhdpi assets for all your app's images.
注意:drawable-xxxhdpi 限定符仅用于提供在 xxhdpi 设备上看起来比平常大的启动器图标。您不需要为所有应用程序的图像提供 xxxhdpi 资产。
more on: http://developer.android.com/design/style/iconography.html
更多信息:http: //developer.android.com/design/style/iconography.html
回答by Kevin van Mierlo
I don't know if there is a device that requires xxx-hdpi, but xx-hdpi is not yet used very often. But the same goes for ldpi, almost no device still requires ldpi. If you just do mdpi, hdpi and xhdpi, it will be just fine. If a device requires something bigger or smaller android just scales it to the right size.
不知道有没有需要xxx-hdpi的设备,但是xx-hdpi还不是很常用。但 ldpi 也是如此,几乎没有设备仍然需要 ldpi。如果只做mdpi、hdpi和xhdpi,就好了。如果设备需要更大或更小的东西,android 只需将其缩放到正确的大小。
Heres what Android says about this:
以下是 Android 对此的说明:
Provide different bitmap drawables for different screen densities
By default, Android scales your bitmap drawables (.png, .jpg, and .gif files) and Nine-Patch drawables (.9.png files) so that they render at the appropriate physical size on each device. For example, if your application provides bitmap drawables only for the baseline, medium screen density (mdpi), then the system scales them up when on a high-density screen, and scales them down when on a low-density screen. This scaling can cause artifacts in the bitmaps. To ensure your bitmaps look their best, you should include alternative versions at different resolutions for different screen densities. The configuration qualifiers you can use for density-specific resources are ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high). For example, bitmaps for high-density screens should go in drawable-hdpi/.
为不同的屏幕密度提供不同的位图可绘制对象
默认情况下,Android 会缩放您的位图可绘制对象(.png、.jpg 和 .gif 文件)和九个补丁可绘制对象(.9.png 文件),以便它们在每个设备上以适当的物理尺寸呈现。例如,如果您的应用程序仅为基线、中等屏幕密度 (mdpi) 提供位图可绘制对象,则系统在高密度屏幕上放大它们,在低密度屏幕上缩小它们。这种缩放会导致位图中出现伪影。为了确保您的位图看起来最好,您应该为不同的屏幕密度包含不同分辨率的替代版本。可用于特定密度资源的配置限定符是 ldpi(低)、mdpi(中)、hdpi(高)和 xhdpi(超高)。例如,高密度屏幕的位图应该放在 drawable-hdpi/ 中。
You can find the documentation here:
您可以在此处找到文档:
https://developer.android.com/guide/practices/screens_support.html
https://developer.android.com/guide/practices/screens_support.html
Hope this helps
希望这可以帮助
回答by Shylendra Madda
回答by Vivek Warde
Forget Everything & make it Simple !
忘记一切,让它变得简单!
Just store highest resolution images in only one folder. Either in drawable-hdpi, & delete other images from the rest drawable folders.
只需将最高分辨率的图像存储在一个文件夹中。在 drawable-hdpi 中,并从其余可绘制文件夹中删除其他图像。
I have tested it in various devices & it works like a charm...
我已经在各种设备上测试过它,它的作用就像一个魅力......