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

标签 android resize drawable

在 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/

相关文章:

android - 速度突然从零跳到无穷大

java - 尝试将文件写入内部数据时不断出现 NullPointerException

android - 如何在android中使用Universal Image Loader获取正在保存的图像路径

css - 调整窗口大小时嵌套的 div 父级重叠子级

android - 如何比较两个 ImageView?

android - 实现 'com.github.prolificinteractive:material-calendarview:2.0' 无法解析

javascript - 使用 jQuery 调整图像大小

jquery - 可拖动的遏制和调整窗口大小

Android textview drawable顶部对齐

android - EditText 中可绘制对象的选择器