请问Android的覆盖资源文件升序或降序排列? [英] Does Android override resources files in ascending or descending order?

查看:139
本文介绍了请问Android的覆盖资源文件升序或降序排列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android有它通过建立资源不同的文件夹。例如,值小,值正常,价值观大,绘制,MDPI,绘制,华电国际,绘制,xhdpi 等如何Android的去了解这些文件夹的拉?它具有较小(值小绘制-MDPI )开始,然后它的方式到更大( 价值观大绘制-xhdpi ),或者它工作在反向开始具有较大的,然后用较小的覆盖?

Android has various folders it goes through to set up its resources. For example, values-small, values-normal, values-large, drawable-mdpi, drawable-hdpi, drawable-xhdpi etc. How does Android go about pulling from these folders? Does it start with the smaller (values-small or drawable-mdpi) and work its way up to the larger (values-large and drawable-xhdpi) or does it work in reverse starting with the larger and then overriding with the smaller?

推荐答案

下面是从的 Android官方文档

在根据屏幕大小限定符选择资源时,
  系统将使用设计资源为比小屏幕
  当前屏幕如果没有资源,更好地匹配(为
  例如,大尺寸屏幕将使用标准尺寸屏幕的资源,如果
  必要)。然而,如果唯一可用的资源是大于
  当前屏幕,系统将不会使用它们,您的应用程序
  将崩溃,如果没有其他资源的匹配设备配置(
  例如,如果所有的布局资源都标有XLARGE预选赛中,
  但该设备是一个普通尺寸屏幕​​)。

When selecting resources based on the screen size qualifiers, the system will use resources designed for a screen smaller than the current screen if there are no resources that better match (for example, a large-size screen will use normal-size screen resources if necessary). However, if the only available resources are larger than the current screen, the system will not use them and your application will crash if no other resources match the device configuration (for example, if all layout resources are tagged with the xlarge qualifier, but the device is a normal-size screen).

因此​​,要回答你的问题:

So to answer your question:

是否先从较小的(价值小或绘制-MDPI)和
  其工作方式到大(价值观大和绘-xhdpi)或
  它工作在反向开始与较大,然后覆盖
  与较小的?

Does it start with the smaller (values-small or drawable-mdpi) and work its way up to the larger (values-large and drawable-xhdpi) or does it work in reverse starting with the larger and then overriding with the smaller?

这将着眼于当前的dpi和尝试检索该目录中的资源。如果没有可用的,它只会搜索密​​度低的降序排列。它不会搜索更高的密度。

It will look at the current dpi and attempt to retrieve the resource from that directory. If not available, it will only search the lower densities in a descending order. It will not search the higher densities.

这篇关于请问Android的覆盖资源文件升序或降序排列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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