<compatible-screens>

英文原文:http://developer.android.com/guide/topics/manifest/compatible-screens-element.html
采集(更新)日期:2014-6-30
搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmub.html

语法:
<compatible-screens>
<screen android:screenSize=["small" | "normal" | "large" | "xlarge"]
android:screenDensity=["ldpi" | "mdpi" | "hdpi" | "xhdpi"] />
...
</compatible-screens>
包含于:
<manifest>
说明:
指定应用程序所兼容的屏幕参数。 Manifest 文件中只能出现一次 <compatible-screens> 元素的实例,但该元素中可以包含多个 <screen> 元素。 每个 <screen> 元素定义了一种可兼容的屏幕尺寸-密度组合。

Android 系统并不会读取 Manifest 文件中的 <compatible-screens> 元素(安装和运行时都不会)。 该元素只是作为一种可被外部服务(比如 Google Play )使用的信息,以便更好地了解应用程序对各种屏幕的兼容性,并对用户启用过滤机制。 在该元素中声明的屏幕参数即表示此应用程序对它不兼容。 这样,外部服务(比如 Google Play )就不会为这些屏幕的设备提供此应用程序。

提醒:通常, 请勿使用本 Manifest 元素 。 如果用户设备的屏幕参数未能列出,则这些用户就无法安装该应用程序,因此使用本元素可能会大幅减少潜在的用户群体。 仅当程序确实无法在所有屏幕参数下运行时,才作为最后手段使用本元素。 作为替代手段,请按照 支持多种屏幕的指导, 通过对应于各种屏幕尺寸和密度的替代 Layout 和位图,为多种屏幕提供可缩放的支持方案。

如果只是要为应用程序设置一个最小屏幕尺寸,应该使用 <supports-screens> 元素。 比如,应用程序只支持 largexlarge 屏幕的设备,就可以在<supports-screens> 中元素声明不支持 smallnormal 屏幕尺寸。 外部服务(比如 Google Play)将据此对应用程序进行过滤。 还可以用 <supports-screens>元素来声明系统是否可以改变应用程序的大小来适应各种屏幕尺寸。

关于 Google Play 如何利用本元素及其他 Manifest 元素来对应用程序进行过滤,详情请参阅 Google Play 的过滤器文档。

子元素:
<screen>
定义应用程序兼容的一种屏幕参数。

<compatible-screens> 中必须至少包含本元素的一个实例。 本元素必须同时包含 android:screenSizeandroid:screenDensity 属性(否则本元素将被忽略)。

属性:

android:screenSize
必填项。定义本条屏幕参数中的屏幕尺寸。

可接受的值:

  • small
  • normal
  • large
  • xlarge

关于各种屏幕尺寸的更多信息,请参阅支持多种屏幕

android:screenDensity
必填项。定义本条屏幕参数中的屏幕密度。

可接受的值:

  • ldpi
  • mdpi
  • hdpi
  • xhdpi

注意: 本属性目前不接受 xxhdpi 值,但可以用 480 来替代,这是最接近 xhdpi 的密度值。

关于屏幕密度的详细信息,请参阅支持多种屏幕

示例:

如果应用程序不论屏幕密度如何都只能兼容 small 和 normal 大小的屏幕,那就必须指定八种不同的 <screen> 元素, 因为每种屏幕尺寸下都有四种不同的密度配置。 每一种组合都必须声明,任何未经声明的尺寸和密度都被视为应用程序不兼容的屏幕参数。 假如应用程序只兼容 small 和 normal 屏幕的话,Manifest 的配置应该类似于这样:

<manifest ... >
...
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>
<application ... >
...
<application>
</manifest>
引入自:
API 级别 9
参阅:
支持多种屏幕
Google Play 的过滤器

Android开发-API指南-<compatible-screens>的更多相关文章

  1. Android开发-API指南-<permission>

    <permission> 英文原文:http://developer.android.com/guide/topics/manifest/permission-element.html 采 ...

  2. Android开发-API指南-<provider>

    <provider> 英文原文:http://developer.android.com/guide/topics/manifest/provider-element.html 采集(更新 ...

  3. Android开发-API指南-应用程序开发基础

    Application Fundamentals 英文原文:http://developer.android.com/guide/components/fundamentals.html 采集(更新) ...

  4. Android开发-API指南-Intent和Intent过滤器

    Intents and Intent Filters 英文原文:http://developer.android.com/guide/components/intents-filters.html 采 ...

  5. Android开发-API指南-Android简介

    Introduction to Android 英文原文:http://developer.android.com/intl/zh-cn/guide/index.html 采集日期:2014-4-16 ...

  6. Android开发-API指南-设备兼容性

    Device Compatibility 英文原文:http://developer.android.com/guide/practices/compatibility.html 采集日期:2014- ...

  7. Android开发-API指南-任务和回退栈

    Task and Back Stack 英文原文: http://developer.android.com/guide/components/tasks-and-back-stack.html 采集 ...

  8. 【最后一篇API译文】Android开发-API指南- Contacts Provider

    Contacts Provider 今年加入了某字幕组,加之杂事颇多,许久未添新文了,惭愧之极. 在听闻 Google 即将重返中国后,近日忽又发现官方网站正在放出 API 中文版,比如本文.当然不是 ...

  9. Android开发-API指南-创建 Content Provider

    Creating a Content Provider 英文原文:http://developer.android.com/guide/topics/providers/content-provide ...

  10. Android开发-API指南-Content Provider基础

    Content Provider Basics 英文原文:http://developer.android.com/guide/topics/providers/content-provider-ba ...

随机推荐

  1. POJ #1042 Gone Fishing - WA by a DP solution. TODO

    I used DP instead of Greedy. But got WA on PoJ, though it passed all web-searched cases. Maybe I hav ...

  2. thinkphp在为图片添加png水印不足的处理

    thinkphp在为图片加水印的时候.如果水印图片是png图片,透明度处理很不理想,与是做以下处理 在Image.class.php中新增 static function imagecopymerge ...

  3. Linux下的NTP

    一.电脑时间的误差众 所周知,电脑主机的时间是根据电脑晶振以固定频率振荡,从而产生的.由于晶振的不同,会导致电脑时间与UTC时间 (全球标准时间:全球标准时间指的是由世界时间标准设定的时间.原先也被称 ...

  4. C#读取系统信息

    using System; using System.Management; namespace Soyee.Comm { /// <summary> /// Computer Infor ...

  5. hostapd移植与使用

    介绍 版本:hostapd-2.5.tar.gz 下载地址:http://w1.fi/releases/hostapd-2.5.tar.gz 依赖:libnl openssl 移植 libnl移植 w ...

  6. libcurl上传文件,添加自定义头

    原文  http://www.cnblogs.com/meteoric_cry/p/4285881.html 主题 curl libcurl参数很多,一不小心就容易遇到问题.曾经就遇到过一个很蛋疼的问 ...

  7. butterknife 使用注意事项

    写了个demo,一直报错 Caused by: java.lang.IllegalStateException: Required view 'tv1' with ID 2131492943 for ...

  8. CF 120F Spider 树的直径 简单题

    一个男孩有n只玩具蜘蛛,每只蜘蛛都是一个树的结构,现在男孩准备把这n只小蜘蛛通过粘贴节点接在一起,形成一只大的蜘蛛.大的蜘蛛也依然是树的结构.输出大的蜘蛛的直径. 知识: 树的直径是指树上的最长简单路 ...

  9. 实现读入一个彩色视频文件并以灰度格式输出这个视频文件,学习opencv例2-10

    #include "cv.h"#include "highgui.h"int main(int argc,char* argv[]){ //书本中的main没有 ...

  10. image和字节流之间的相互转换

    //将图片转化为长二进制 public Byte[] SetImgToByte(string imgPath) { FileStream file = new FileStream(imgPath, ...