Android的资源和QUOT;最佳匹配QUOT;后备逻辑 [英] Android resources "best match" fallback logic

查看:104
本文介绍了Android的资源和QUOT;最佳匹配QUOT;后备逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过的文档有关安卓资源我想我已经明白使用Android的最佳匹配逻辑来确定哪个目录特定资源应首先搜索..假设的绘制 - 华电国际绘制烯端口的和可绘制恩*匹配当前的设备配置,绘制烯端口的是最好的匹配目录..我的问题是,如果没有的<​​em>绘制发现了绘制 - 烯端口的,不系统的直视中的绘制的或它看起来在第二最佳匹配的绘制恩的,然后在第三个最佳比赛的绘制 - 华电国际的等等,直到它达到的绘制的?我想是这样工作的,但我没有找到它的文档明确地说,(除非我读过他们的速度太快了,你一定会杀了我:))。

I've read the docs about Android Resources and I think I've understood the best-matching logic used by android to identify in which directory a particular resource should be searched first.. Supposing that drawable-hdpi, drawable-en-port and drawable-en* match the current device configuration, drawable-en-port is the best matching directory.. My question is, if a drawable is not found in drawable-en-port, does the system look directly in drawable or does it look in the second-best-match drawable-en and then in the third best match drawable-hdpi and so on until it reaches drawable? I suppose it works this way, but I did not find it explicitly said in the docs (unless I've read them too quickly and you will surely kill me :) ).

推荐答案

是它首先在绘制恩,然后绘制,华电国际由于语言预选赛具有较高的precedence。如果仍然没有找到值绘制目录搜索。它是按照: 如何安卓找到最佳匹配资源

Yes it looks first in the drawable-en, then drawable-hdpi because language qualifier has higher precedence. If value was still not found drawable directory is searched. It is in accordance with: How Android Finds the Best-matching Resource

如果绘制恩包含然后匹配的资源绘制 - 华电国际绘制将基于所述算法的步骤4消除。

If drawable-en contains matching resource then drawable-hdpi and drawable would be eliminated based on step 4 of the algorithm.

这篇关于Android的资源和QUOT;最佳匹配QUOT;后备逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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