- 語法:
-
<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 的篩選功能
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-05-16 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Translation issue"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]