清单中的android anydensity [英] android anydensity in manifest

查看:242
本文介绍了清单中的android anydensity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序遇到了一个令人惊讶的问题.

I have encountered an amazing problem, in my application.

当我在清单中放入anyDensity标记为false时,我的应用程序运行良好,但是只要我做到了,我的应用程序就会表现模糊,我会在我的应用程序上创建一些位图. 如果我在清单中做anyDensity标记为false,那么任何设备都会出现问题,那么许多设备将无法在Playstore上看到我的应用, 任何帮助将不胜感激.

When i put anyDensity tag false in manifest my application runs fine, but whenever i make it true my application acts blurry, i am creating some bitmaps on my application. any there is a problem if i do anyDensity tag false in manifest then many devices would not able to see my app on playstore, Any help will be appreciated.

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

推荐答案

不过,您的原始帖子中没有太多信息.该文档指出:

not too much info in your original post, however. The documentation states:

指示应用程序是否包含可容纳的资源 任何屏幕密度.对于支持Android 1.6(API 4级及更高级别),默认情况下为"true",您不应设置 除非您绝对确定这是必要的,否则它为假" 您的应用程序正常工作.唯一必要的时间是 如果您的应用直接操作位图,则禁用此功能

Indicates whether the application includes resources to accommodate any screen density. For applications that support Android 1.6 (API level 4) and higher, this is "true" by default and you should not set it "false" unless you're absolutely certain that it's necessary for your application to work. The only time it might be necessary to disable this is if your app directly manipulates bitmaps

所以我的第一个问题是,您是否包括所有资源以适应任何屏幕密度(即mdpi,hdpi,xhdpi,xxhdpi)?如果是,则应该没问题.在上面引用的最后一句话之后,我到达了这个链接.

So my first question is do you include all resources to accomodate any screen density (i. e. mdpi, hdpi, xhdpi, xxhdpi)? If yes, You should be fine. Following the last sentences of the quote above I arrived at this link.

它说:

应用程序可以通过设置android:anyDensity禁用预缩放 清单中的"false"或通过设置以编程方式将其设置为位图 inScaled为"false".

An application can disable pre-scaling by setting android:anyDensity to "false" in the manifest or programmatically for a Bitmap by setting inScaled to "false".

您是否尝试过以编程方式对位图进行操作,而不是在整个应用程序中全局禁用此标志?

Have you tried doing it programmatically for your bitmaps, instead of disabling this flag globally for the whole app?

最后还有部分.也许会对您正确处理自定义位图有帮助?具体来说,此段听起来像是您的问题:

And finally there is this section. Maybe it will be helpful to you in properly handling your custom bitmaps? Specifically, this paragraph sound like your problem:

如果您的应用程序创建了内存中的位图(位图对象),则 系统假定位图是为基线设计的 默认情况下为中等密度屏幕,并在绘制时自动缩放位图 时间.当位图时,系统将自动缩放"应用于位图 具有未指定的密度特性.如果您没有正确考虑 当前设备的屏幕密度,并指定位图的密度 属性,自动缩放可以导致缩放工件相同 就像您不提供其他资源一样.

If your application creates an in-memory bitmap (a Bitmap object), the system assumes that the bitmap is designed for the baseline medium-density screen, by default, and auto-scales the bitmap at draw time. The system applies "auto-scaling" to a Bitmap when the bitmap has unspecified density properties. If you don't properly account for the current device's screen density and specify the bitmap's density properties, the auto-scaling can result in scaling artifacts the same as when you don't provide alternative resources.

这篇关于清单中的android anydensity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆