- 語法:
-
<compatible-screens> <screen android:screenSize=["small" | "normal" | "large" | "xlarge"] android:screenDensity=["ldpi" | "mdpi" | "hdpi" | "xhdpi" | "280" | "360" | "420" | "480" | "560" ] /> ... </compatible-screens>
- 包含於:
<manifest>
- 說明:
- 指定與應用程式相容的各個螢幕設定。資訊清單中只能有一個
<compatible-screens>
元素,但可包含多個<screen>
元素。每個<screen>
元素均會指定與應用程式相容的特定螢幕密度組合。Android 系統「不會」讀取
<compatible-screens>
資訊清單 元素。此元素僅供參考 透過 Google Play 等外部服務使用,進一步瞭解應用程式的相容性 並能為使用者啟用篩選功能。任何螢幕設定 在這個元素中宣告「未」是應用程式「未」存取的螢幕 相容。Google Play 等外部服務不會將應用程式提供給 也就是顯示這類螢幕的裝置
注意:一般情況下,請勿使用這個資訊清單 元素。使用這個元素可大幅縮小您的潛在使用者族群 應用程式,藉此阻止使用者安裝有螢幕的裝置 一些檢查設定只有在不得已的情況下, 應用程式就無法與特定螢幕設定搭配運作。與其使用 元素,請按照支援多個畫面指南操作, 使用替代版面配置和點陣圖,為多個螢幕提供可擴充的支援 適合不同的螢幕大小和像素密度
如果您要為應用程式設定最小螢幕尺寸,請使用
<supports-screens>
元素。舉例來說,如果您想提供應用程式 僅適用於大螢幕和超大螢幕裝置,<supports-screens>
元素可讓您 您宣告應用程式不支援小螢幕和一般螢幕大小。 接著,Google Play 等外部服務會據此篩選您的應用程式。您也可以使用<supports-screens>
元素,以宣告系統是否可以 適合不同螢幕尺寸的應用程式如要進一步瞭解 Google Play 如何運用 其他資訊清單元素,請參閱「Google Play 的篩選器」。
- 子元素:
- 例如
-
如果您的應用程式只相容小螢幕和一般螢幕 就必須指定 12 個
<screen>
元素 因為每種螢幕大小有六種不同的密度設定。您必須個別宣告 這些原則系統會將所有您「未指定」的大小和密度組合,視為一個畫面 設定與應用程式「不相容」。如果您的應用程式僅與小型和一般螢幕相容,資訊清單項目會顯示如下:
<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" /> <screen android:screenSize="small" android:screenDensity="xxhdpi" /> <screen android:screenSize="small" android:screenDensity="xxxhdpi" /> <!-- 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" /> <screen android:screenSize="normal" android:screenDensity="xxhdpi" /> <screen android:screenSize="normal" android:screenDensity="xxxhdpi" /> </compatible-screens> <application ... > ... <application> </manifest>
- 導入版本:
- API 級別 9
- 另請參閱:
- 螢幕相容性總覽
- Google Play 的篩選功能
相容螢幕(<螢幕)>
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# <compatible-screens\u003e\n\nsyntax:\n:\n\n ```xml\n \u003ccompatible-screens\u003e\n \u003cscreen android:screenSize=[\"small\" | \"normal\" | \"large\" | \"xlarge\"]\n android:screenDensity=[\"ldpi\" | \"mdpi\" | \"hdpi\" | \"xhdpi\"\n | \"280\" | \"360\" | \"420\" | \"480\" | \"560\" ] /\u003e\n ...\n \u003c/compatible-screens\u003e\n ```\n\ncontained in:\n: [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element)\n\ndescription:\n: Specifies each screen configuration with which the application is compatible. Only one instance\n of the `\u003ccompatible-screens\u003e` element is allowed in the manifest, but it can\n contain multiple `\u003cscreen\u003e` elements. Each `\u003cscreen\u003e` element\n specifies a specific screen size-density combination with which the application is compatible.\n\n The Android system *doesn't* read the `\u003ccompatible-screens\u003e` manifest\n element at any point. This element is informational only and is used\n by external services, such as Google Play, to better understand the application's compatibility\n with specific screen configurations and to enable filtering for users.\n\n\n Any screen configuration that\n *isn't* declared in this element is a screen with which the application *isn't*\n compatible. External services, such as Google Play, don't provide the application to\n devices with such screens.\n\n\n **Caution:** Normally, *you don't use this manifest\n element* . Using this element can dramatically reduce the potential user base for your\n application by preventing users from installing your application if they have a device with a screen\n configuration that you don't list. Use it only as a last resort, when the\n application absolutely doesn't work with specific screen configurations. Instead of using this\n element, follow the guide to [supporting multiple screens](/guide/practices/screens_support) to\n provide scalable support for multiple screens using alternative layouts and bitmaps\n for different screen sizes and densities.\n\n\n If you want to set a minimum screen size for your your application, use the [`\u003csupports-screens\u003e`](/guide/topics/manifest/supports-screens-element) element. For example, if you want your application to be available\n only for large and extra-large screen devices, the `\u003csupports-screens\u003e` element lets\n you declare that your application doesn't support small and normal screen sizes.\n Then, external services like Google Play filter your application accordingly. You can also use the\n `\u003csupports-screens\u003e` element to declare whether the system can resize your\n application for different screen sizes.\n\n\n For more information about how Google Play filters applications using this and\n other manifest elements, see [Filters on Google Play](/google/play/filters).\n\n\nchild elements:\n:\n\n `\u003cscreen\u003e`\n\n : Specifies a single screen configuration with which the application is compatible.\n\n At least one instance of this element must be placed inside the `\u003ccompatible-screens\u003e`\n element. This element must include both the `android:screenSize` and\n `android:screenDensity` attributes. If you don't declare both\n attributes, then the element is ignored.\n\n Attributes:\n\n `android:screenSize`\n : **Required.** Specifies the screen size for this screen configuration.\n\n Accepted values:\n\n - `small`\n - `normal`\n - `large`\n - `xlarge`\n\n\n For information about the different screen sizes, see [Screen compatibility overview](/guide/practices/screens_support#sizes).\n\n `android:screenDensity`\n : **Required.** Specifies the screen density for this screen configuration.\n\n Accepted values:\n\n - `\"ldpi\"` (approximately 120 dpi)\n - `\"mdpi\"` (approximately 160 dpi)\n - `\"hdpi\"` (approximately 240 dpi)\n - `\"xhdpi\"` (approximately 320 dpi)\n - `\"280\"`\n - `\"360\"`\n - `\"420\"`\n - `\"480\"`\n - `\"560\"`\n\n\n For information about the different screen densities, see [Screen compatibility overview](/guide/practices/screens_support#density).\n\n\nexample\n\n: If your application is compatible with only small and normal screens, regardless\n of screen density, then you must specify 12 `\u003cscreen\u003e` elements,\n because each screen size has six different density configurations.\n\n You must declare each one of\n these. Any combination of size and density that you *don't* specify is considered a screen\n configuration with which your application *isn't* compatible. Here's what the manifest\n entry looks like if your application is compatible with only small and normal screens: \n\n ```xml\n \u003cmanifest ... \u003e\n ...\n \u003ccompatible-screens\u003e\n \u003c!-- all small size screens --\u003e\n \u003cscreen android:screenSize=\"small\" android:screenDensity=\"ldpi\" /\u003e\n \u003cscreen android:screenSize=\"small\" android:screenDensity=\"mdpi\" /\u003e\n \u003cscreen android:screenSize=\"small\" android:screenDensity=\"hdpi\" /\u003e\n \u003cscreen android:screenSize=\"small\" android:screenDensity=\"xhdpi\" /\u003e\n \u003cscreen android:screenSize=\"small\" android:screenDensity=\"xxhdpi\" /\u003e\n \u003cscreen android:screenSize=\"small\" android:screenDensity=\"xxxhdpi\" /\u003e\n \u003c!-- all normal size screens --\u003e\n \u003cscreen android:screenSize=\"normal\" android:screenDensity=\"ldpi\" /\u003e\n \u003cscreen android:screenSize=\"normal\" android:screenDensity=\"mdpi\" /\u003e\n \u003cscreen android:screenSize=\"normal\" android:screenDensity=\"hdpi\" /\u003e\n \u003cscreen android:screenSize=\"normal\" android:screenDensity=\"xhdpi\" /\u003e\n \u003cscreen android:screenSize=\"normal\" android:screenDensity=\"xxhdpi\" /\u003e\n \u003cscreen android:screenSize=\"normal\" android:screenDensity=\"xxxhdpi\" /\u003e\n \u003c/compatible-screens\u003e\n \u003capplication ... \u003e\n ...\n \u003capplication\u003e\n \u003c/manifest\u003e\n ```\n\nintroduced in:\n: API level 9\n\nsee also:\n: [Screen compatibility overview](/guide/practices/screens_support)\n: [Filters on Google Play](/google/play/filters)"]]