1page.title=<compatible-screens> 2parent.title=The AndroidManifest.xml File 3parent.link=manifest-intro.html 4@jd:body 5 6<dl class="xml"> 7<dt>syntax:</dt> 8<dd> 9<pre> 10<<a href="#compatible-screens">compatible-screens</a>> 11 <<a href="#screen">screen</a> android:<a href="#screenSize">screenSize</a>=["small" | "normal" | "large" | "xlarge"] 12 android:<a href="#screenDensity">screenDensity</a>=["ldpi" | "mdpi" | "hdpi" | "xhdpi"] /> 13 ... 14</compatible-screens> 15</pre> 16</dd> 17 18<dt>contained in:</dt> 19<dd><code><a 20href="{@docRoot}guide/topics/manifest/manifest-element.html"><manifest></a></code></dd> 21 22<dt>description:</dt> 23<dd>Specifies each screen configuration with which the application is compatible. Only one instance 24of the {@code <compatible-screens>} element is allowed in the manifest, but it can 25contain multiple <code><screen></code> elements. Each <code><screen></code> element 26specifies a specific screen size-density combination with which the application is compatible. 27 28 <p>The Android system <em>does not</em> read the {@code <compatible-screens>} manifest 29element (neither at install-time nor at runtime). This element is informational only and may be used 30by external services (such as Google Play) to better understand the application's compatibility 31with specific screen configurations and enable filtering for users. Any screen configuration that is 32<em>not</em> declared in this element is a screen with which the application is <em>not</em> 33compatible. Thus, external services (such as Google Play) should not provide the application to 34devices with such screens.</p> 35 36 <p class="caution"><strong>Caution:</strong> Normally, <strong>you should not use this manifest 37element</strong>. Using this element can dramatically reduce the potential user base for your 38application, by not allowing users to install your application if they have a device with a screen 39configuration that you have not listed. You should use it only as a last resort, when the 40application absolutely does not work with all screen configurations. Instead of using this element, 41you should follow the guide to <a href="{@docRoot}guide/practices/screens_support.html">Supporting 42Multiple Screens</a>, in order to provide complete support for multiple screens, by adding 43alternative resources for different screen sizes and densities.</p> 44 45 <p>If you want to set only a minimum screen <em>size</em> for your your application, then you 46should use the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code 47<supports-screens>}</a> element. For example, if you want your application to be available 48only for <em>large</em> and <em>xlarge</em> screen devices, the <a 49href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code 50<supports-screens>}</a> element allows you to declare that your application does not 51support <em>small</em> and <em>normal</em> screen sizes. External services (such as Google 52Play) will filter your application accordingly. You can also use the <a 53href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code 54<supports-screens>}</a> element to declare whether the system should resize your 55application for different screen sizes.</p> 56 57 <p>Also see the <a href="{@docRoot}guide/google/play/filters.html">Filters on Google Play</a> 58document for more information about how Google Play filters applications using this and 59other manifest elements.</p> 60 61</dd> 62 63<dt>child elements:</dt> 64<dd> 65 <dl class="tag-list"> 66 67 <dt id="screen">{@code <screen>}</dt> 68 <dd>Specifies a single screen configuration with which the application is compatible. 69 <p>At least one instance of this element must be placed inside the {@code 70<compatible-screens>} element. This element <em>must include both</em> the {@code 71android:screenSize} and {@code android:screenDensity} attributes (if you do not declare both 72attributes, then the element is ignored).</p> 73 74 <p class="caps">attributes:</p> 75 <dl class="atn-list"> 76 <dt id="screenSize"><code>android:screenSize</code></dt> 77 <dd><b>Required.</b> Specifies the screen size for this screen configuration. 78 <p>Accepted values:</p> 79 <ul> 80 <li>{@code small}</li> 81 <li>{@code normal}</li> 82 <li>{@code large}</li> 83 <li>{@code xlarge}</li> 84 </ul> 85 <p>For information about the different screen sizes, see <a 86href="{@docRoot}guide/practices/screens_support.html#range">Supporting Multiple Screens</a>.</p> 87 </dd> 88 <dt id="screenDensity"><code>android:screenDensity</code></dt> 89 <dd><b>Required.</b> Specifies the screen density for this screen configuration. 90 <p>Accepted values:</p> 91 <ul> 92 <li>{@code ldpi}</li> 93 <li>{@code mdpi}</li> 94 <li>{@code hdpi}</li> 95 <li>{@code xhdpi}</li> 96 </ul> 97 <p>For information about the different screen densities, see <a 98href="{@docRoot}guide/practices/screens_support.html#range">Supporting Multiple Screens</a>.</p> 99 </dd> 100 </dl> 101 </dd> 102 </dl> 103</dd> 104 105<dt>example</dt> 106<dd> 107<p>If your application is compatible with only small and normal screens, regardless 108of screen density, then you must specify eight different {@code <screen>} elements, 109because each screen size has four different density configurations. You must declare each one of 110these; any combination of size and density that you do <em>not</em> specify is considered a screen 111configuration with which your application is <em>not</em> compatible. Here's what the manifest 112entry looks like if your application is compatible with only small and normal screens:</p> 113 114<pre> 115<manifest ... > 116 ... 117 <compatible-screens> 118 <!-- all small size screens --> 119 <screen android:screenSize="small" android:screenDensity="ldpi" /> 120 <screen android:screenSize="small" android:screenDensity="mdpi" /> 121 <screen android:screenSize="small" android:screenDensity="hdpi" /> 122 <screen android:screenSize="small" android:screenDensity="xhdpi" /> 123 <!-- all normal size screens --> 124 <screen android:screenSize="normal" android:screenDensity="ldpi" /> 125 <screen android:screenSize="normal" android:screenDensity="mdpi" /> 126 <screen android:screenSize="normal" android:screenDensity="hdpi" /> 127 <screen android:screenSize="normal" android:screenDensity="xhdpi" /> 128 </compatible-screens> 129 <application ... > 130 ... 131 <application> 132</manifest> 133</pre> 134</dd> 135 136<dt>introduced in:</dt> 137<dd>API Level 9</dd> 138<dt>see also:</dt> 139<dd><a 140href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></dd> 141<dd><a href="{@docRoot}guide/google/play/filters.html">Filters on Google Play</a></dd> 142</dl> 143