Android Resource 怎样加载资源文件(3)

来源:互联网 发布:淘宝账号查询 编辑:程序博客网 时间:2024/05/01 12:13
当要求一个你提供了选择中的资源,安卓根据当前设备配置,在运行时候进行选择。为了证明安卓如何选择资源,建设下面的图片目录每个都包含不同版本的相同图片。

* drawable/
* drawable-en/
* drawable-fr-rCA/
* drawable-en-port/
* drawable-en-notouch-12key/
* drawable-port-ldpi/
* drawable-port-notouch-12key/
假设下面是设备的配置信息
* Locale=en-GB
* Screen orientation=port
* Touchscreen type=notouch
* Primary text input method =12key
通过设备配置信息和可选择资源,选择drawable-en-port.逻辑流程如下:
1.排除和设备相矛盾的文件drawable-fr-rCA
2.选择最高优先MCC 向下–》
3.循环遍历一直找有没有标签
4.排除所有没有配置中的标签的文件drawable/ ,drawable-port-ldpi/和drawable-port-notouch-12key/

0 0
原创粉丝点击