为什么Android使用资源从更高的资源,而不是低? [英] Why Android uses resources from the higher resource instead of a lower?
问题描述
有是我想领养到xhdpi分辨率手机的应用程序。所以我做的资源该决议以及所有关于xhdpi手机了罚款。
There is an app which I want to adopt to xhdpi resolution phones. So I made resources for that resolution and all went fine regarding the xhdpi phones.
我有一个测试手机是正常华电国际
和布局,现在搞砸了(在我的手机xhdpi作出修正。
I have a test mobile phone which is normal hdpi
and the layout is now messed up (after I made fixes for xhdpi phones.
布局结构如下:
的 / RES /绘,HDPI结果
/ RES /绘正常,xhdpi结果
/ RES /布局结果
/ RES /布局正常xhdpi 的
当我上加载正常华电国际
手机的应用程序,我看到它使用的布局从 / RES /布局正常xhdpi
及图片来自 / RES /绘正常-xhdpi
。
When I load the app on normal hdpi
phone, I see that it uses layout from /res/layout-normal-xhdpi
and images from /res/drawable-normal-xhdpi
.
难道不应该使用的资源从低资源文件夹如 / RES /布局
和 / RES /绘,华电国际
?这不,我不知道为什么。
Shouldn't it use resources from the lower resource folder like /res/layout
and /res/drawable-hdpi
? It does not and I do not know why.
推荐答案
据<一个href=\"http://developer.android.com/intl/zh-CN/guide/topics/resources/providing-resources.html#BestMatch\"相对=nofollow> Android如何寻找相矛盾的设备配置最匹配的资源系统消除了资源文件,但看起来,因为此异常像你的情况预计,
According to How Android Finds the Best-matching Resource system eliminates resource files that contradict the device configuration, but it looks like your case is expected, because of this exception:
例外:屏幕像素密度是一个定性未因矛盾消除
Exception: Screen pixel density is the one qualifier that is not eliminated due to a contradiction.
本办法正常华电国际的设备
配置相匹配,以 / RES /绘正常-xhdpi
。
This way a device of normal hdpi
configuration matches to /res/drawable-normal-xhdpi
.
这篇关于为什么Android使用资源从更高的资源,而不是低?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!