gpt4 book ai didi

android - 调整图像大小以放入 ldpi、hdpi 屏幕的正确方法

转载 作者:太空狗 更新时间:2023-10-29 13:42:18 26 4
gpt4 key购买 nike

在 hdpi 屏幕和 ldpi 屏幕中调整图像尺寸的正确方法是什么。

例如,在我的 droid 2 上,89*80 的 png 显示效果很好,带有文本....但我应该如何调整图像大小,使其在屏幕较小的 droid 上变小?我是手动更改图像并将其放入 ldpi 文件夹还是自动执行?

最佳答案

手动更改图像并将其放入 LDPI 文件夹中。

有用的资源: Screen Support - 一个 Android 应用程序如何支持多种屏幕尺寸和密度的概要。 Alternative Resources - 根据屏幕类型使用不同资源(布局、PNG 文件等)的指南。

从屏幕支持页面:

Based on the density of the current screen, the platform automatically loads any size- or density-specific resources from your application and displays them without scaling. If no matching resources are available, the platform loads the default resources and scales them up or down as needed to match the current screen's generalized density. The platform assumes that default resources are designed for proper display at the baseline screen density of "medium" (160), unless they are loaded from a density-specific resource directory. For example, if the current screen's density is "high", the platform loads resources that are tagged with the qualifier hdpi and uses them without scaling. If no such resources are available, the platform uses the default resources instead, scaling them from the baseline density ("medium") to "high".

关于android - 调整图像大小以放入 ldpi、hdpi 屏幕的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4260194/

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