- ไวยากรณ์:
-
<compatible-screens> <screen android:screenSize=["small" | "normal" | "large" | "xlarge"] android:screenDensity=["ldpi" | "mdpi" | "hdpi" | "xhdpi" | "280" | "360" | "420" | "480" | "560" ] /> ... </compatible-screens>
- ที่อยู่ใน:
<manifest>
- description:
- ระบุการกำหนดค่าหน้าจอแต่ละรายการที่แอปพลิเคชันใช้ร่วมกันได้ อินสแตนซ์เดียวเท่านั้น
ของเอลิเมนต์
<compatible-screens>
ได้รับอนุญาตในไฟล์ Manifest แต่ มีองค์ประกอบ<screen>
หลายรายการ องค์ประกอบ<screen>
แต่ละรายการ ระบุชุดค่าผสมความหนาแน่นของขนาดหน้าจอที่เฉพาะเจาะจงกับแอปพลิเคชันที่เข้ากันได้ระบบ Android ไม่อ่านไฟล์ Manifest
<compatible-screens>
ได้ทุกเมื่อ องค์ประกอบนี้เป็นการให้ข้อมูลเท่านั้นและมีการใช้ โดยบริการภายนอก เช่น Google Play เพื่อให้เข้าใจความเข้ากันได้ของแอปพลิเคชันได้ดียิ่งขึ้น ด้วยการกำหนดค่าหน้าจอที่เฉพาะเจาะจงและเปิดใช้การกรองสำหรับผู้ใช้การกำหนดค่าหน้าจอที่ ไม่ได้ประกาศไว้ในองค์ประกอบนี้เป็นหน้าจอที่แอปพลิเคชันไม่ได้ ที่เข้ากันได้ บริการภายนอก เช่น Google Play ไม่มีแอปพลิเคชันสำหรับ อุปกรณ์ที่มีหน้าจอดังกล่าว
ข้อควรระวัง: โดยปกติคุณไม่ได้ใช้ไฟล์ Manifest นี้ องค์ประกอบ การใช้องค์ประกอบนี้สามารถลดฐานผู้ใช้ที่ มีโอกาสสำหรับ แอปพลิเคชันโดยป้องกันไม่ให้ผู้ใช้ติดตั้งแอปพลิเคชันของคุณหากมีอุปกรณ์ที่มีหน้าจอ การกำหนดค่าที่คุณไม่ได้ระบุไว้ ให้ใช้วิธีนี้เป็นทางเลือกสุดท้ายเมื่อ แอปพลิเคชันไม่สามารถใช้ได้กับการกำหนดค่าหน้าจอบางอย่างโดยเฉพาะ แทนที่จะใช้ ให้ทำตามคำแนะนำในการรองรับหลายหน้าจอเพื่อ ให้การสนับสนุนที่รองรับการปรับขนาดสำหรับหน้าจอหลายหน้าจอโดยใช้เค้าโครงอื่นและบิตแมป สำหรับขนาดและความหนาแน่นของหน้าจอที่แตกต่างกัน
หากต้องการตั้งค่าขนาดหน้าจอขั้นต่ำสำหรับแอปพลิเคชันของคุณ ให้ใช้องค์ประกอบ
<supports-screens>
ตัวอย่างเช่น หากคุณต้องการให้แอปพลิเคชันพร้อมใช้งาน เฉพาะสำหรับอุปกรณ์ที่มีหน้าจอขนาดใหญ่และขนาดใหญ่พิเศษ องค์ประกอบ<supports-screens>
คุณประกาศว่าแอปพลิเคชันของคุณไม่รองรับหน้าจอขนาดเล็กและปกติ จากนั้นบริการภายนอก เช่น Google Play จะกรองแอปพลิเคชันของคุณให้เหมาะสม คุณยังสามารถใช้<supports-screens>
องค์ประกอบเพื่อประกาศว่าระบบสามารถปรับขนาด แอปพลิเคชันสำหรับหน้าจอขนาดต่างๆสำหรับข้อมูลเพิ่มเติมเกี่ยวกับวิธีที่ Google Play กรองแอปพลิเคชันโดยใช้ตัวกรองนี้และ องค์ประกอบอื่นๆ ของไฟล์ Manifest โปรดดูตัวกรองใน Google Play
- องค์ประกอบย่อย:
- example (ตัวอย่าง)
-
หากแอปพลิเคชันของคุณใช้ได้กับหน้าจอขนาดเล็กและหน้าจอปกติเท่านั้น โดยไม่คำนึงถึง ความหนาแน่นของหน้าจอแล้ว คุณต้องระบุองค์ประกอบ
<screen>
12 องค์ประกอบ เนื่องจากหน้าจอแต่ละขนาดมีการกำหนดค่าความหนาแน่น 6 แบบคุณต้องประกาศแต่ละรายการ เหล่านี้ ชุดค่าผสมของขนาดและความหนาแน่นที่คุณไม่ระบุจะถือว่าเป็นหน้าจอ ที่แอปพลิเคชันของคุณไม่สามารถทำงานร่วมกันได้ ไฟล์ 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" /> <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
<compatible- screen> (หน้าจอที่ใช้ร่วมกันได้)
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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 UTC"],[],[],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)"]]