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