android - 从高分辨率文件夹中提取图像时出现问题

标签 android drawable

我的 res 文件夹中有 3 个可绘制文件夹。 drawable-ldpi、drawable-mdpi 和 drawable-hdpi。我有这些文件夹的低、中、高分辨率图像。

我一直在 Samsung Moment 上测试我的应用程序,这是一个 mdpi 屏幕。今天,我去三星 Epic (480x800) 上测试我的应用程序,它是 hdpi 屏幕。不幸的是,我的应用程序使用的图像是错误地从 drawable-mdpi 屏幕而不是 drawable-hdpi 中提取的。

有人知道为什么吗?

两个文件夹中的图像名称相同。此外,在我的 list 中,我有以下标签:

<supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="true"
        />

我不太确定为什么它不会从 drawable-hdpi 文件夹中提取图像。

最佳答案

我读了一些关于这个主题的内容,我认为你不了解屏幕自动调整的工作方式,我相信你可以从 list 中删除整个部分,它应该根据我读到的默认值工作,尽管我对此可能是错误的。

取自此处:Manifest attributes for screens support

In general, when you declare a screen-size attribute (smallScreens, normalScreens, largeScreens, or xlargeScreens) as "true", you are signaling to the platform that your application is designed to render properly on that screen size. As a result, the platform does not apply any size-compatibility features (such as a virtual HVGA display area). If you declare a screen-size attribute as "false", you are signaling that your application is not designed for that screen size. In this case, the platform does apply size-compatibility features, rendering the application in an HVGA baseline display area. If the current screen is larger than normal size, the platform renders the application in a virtual HVGA screen on the larger screen.

请仔细阅读我发布的链接,它应该提供更清晰的图片,因为它有几个示例。

关于android - 从高分辨率文件夹中提取图像时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4370951/

相关文章:

android - 我应该为 Android 应用创建多大的尺寸?

android - 如何在调用 Drawable.draw(canvas) 时隐藏一个 drawable?

android - Android TextView 到图像文件?

java - Drawable不会在SurfaceView上绘制,Thread实现,不重写onDraw

android - 我想不通

android - ActiveAndroid 只保存唯一数据

android - Eclipse 相对布局很难工作

android - 创建 View 轮播

android - 无法解析依赖 firebase 和 google play 服务

android - 从应用程序缓存加载时 ListView 滞后