gpt4 book ai didi

android - 如果文件夹中没有 xxhdpi 资源?

转载 作者:太空狗 更新时间:2023-10-29 16:20:17 27 4
gpt4 key购买 nike

如果我在除 xxhdpi 文件夹之外的所有文件夹中都有资源,xxhdpi 设备是否会默认从其他文件夹之一获取资源?换句话说,我必须为 xxhdpi 文件夹制作资源吗?我有这张图表,但我不确定 xxhdpi 我想开导一下

xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
Generalised Dpi values for screens:

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).
Therefore generalised size of your resources (assuming they are full screen):

ldpi
Vertical = 426 * 120 / 160 = 319.5px
Horizontal = 320 * 120 / 160 = 240px
mdpi
Vertical = 470 * 160 / 160 = 470px
Horizontal = 320 * 160 / 160 = 320px
hdpi
Vertical = 640 * 240 / 160 = 960px
Horizontal = 480 * 240 / 160 = 720px
xhdpi
Vertical = 960 * 320 / 160 = 1920px
Horizontal = 720 * 320 / 160 = 1440px

px = dp*dpi/160

最佳答案

如果您没有任何 xxhdpi 资源,它将尝试从可能的“最佳”来源获取资源。

来自 google developer site :

  • The system uses the appropriate alternative resource

Based on the size and density of the current screen, the system uses any size- and density-specific resource provided in your application. For example, if the device has a high-density screen and the application requests a drawable resource, the system looks for a drawable resource directory that best matches the device configuration. Depending on the other alternative resources available, a resource directory with the hdpi qualifier (such as drawable-hdpi/) might be the best match, so the system uses the drawable resource from this directory.

  • If no matching resource is available, the system uses the default resource and scales it up or down as needed to match the current screen size and density

The "default" resources are those that are not tagged with a configuration qualifier. For example, the resources in drawable/ are the default drawable resources. 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.

关于android - 如果文件夹中没有 xxhdpi 资源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16977506/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com