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"] /&gt;
     13     ...
     14 &lt;/compatible-screens&gt;
     15 </pre>
     16 </dd>
     17 
     18 <dt>contained in:</dt>
     19 <dd><code><a
     20 href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
     21 
     22 <dt>description:</dt>
     23 <dd>Specifies each screen configuration with which the application is compatible. Only one instance
     24 of the {@code &lt;compatible-screens&gt;} element is allowed in the manifest, but it can
     25 contain multiple <code>&lt;screen&gt;</code> elements. Each <code>&lt;screen&gt;</code> element
     26 specifies 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 &lt;compatible-screens&gt;} manifest
     29 element (neither at install-time nor at runtime). This element is informational only and may be used
     30 by external services (such as Google Play) to better understand the application's compatibility
     31 with 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>
     33 compatible. Thus, external services (such as Google Play) should not provide the application to
     34 devices with such screens.</p>
     35 
     36   <p class="caution"><strong>Caution:</strong> Normally, <strong>you should not use this manifest
     37 element</strong>. Using this element can dramatically reduce the potential user base for your
     38 application, by not allowing users to install your application if they have a device with a screen
     39 configuration that you have not listed. You should use it only as a last resort, when the
     40 application absolutely does not work with all screen configurations. Instead of using this element,
     41 you should follow the guide to <a href="{@docRoot}guide/practices/screens_support.html">Supporting
     42 Multiple Screens</a>, in order to provide complete support for multiple screens, by adding
     43 alternative 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
     46 should use the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
     47 &lt;supports-screens&gt;}</a> element. For example, if you want your application to be available
     48 only for <em>large</em> and <em>xlarge</em> screen devices, the <a
     49 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
     50 &lt;supports-screens&gt;}</a> element allows you to declare that your application does not
     51 support <em>small</em> and <em>normal</em> screen sizes. External services (such as Google
     52 Play) will filter your application accordingly. You can also use the <a
     53 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
     54 &lt;supports-screens&gt;}</a> element to declare whether the system should resize your
     55 application for different screen sizes.</p>
     56 
     57   <p>Also see the <a href="{@docRoot}google/play/filters.html">Filters on Google Play</a>
     58 document for more information about how Google Play filters applications using this and
     59 other 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 &lt;screen&gt;}</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 &lt;compatible-screens&gt;} element. This element <em>must include both</em> the {@code
     71 android:screenSize} and {@code android:screenDensity} attributes (if you do not declare both
     72 attributes, 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
     86 href="{@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
     98 href="{@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
    108 of screen density, then you must specify eight different {@code &lt;screen&gt;} elements,
    109 because each screen size has four different density configurations. You must declare each one of
    110 these; any combination of size and density that you do <em>not</em> specify is considered a screen
    111 configuration with which your application is <em>not</em> compatible. Here's what the manifest
    112 entry looks like if your application is compatible with only small and normal screens:</p>
    113 
    114 <pre>
    115 &lt;manifest ... >
    116     ...
    117     &lt;compatible-screens>
    118         &lt;!-- all small size screens -->
    119         &lt;screen android:screenSize="small" android:screenDensity="ldpi" />
    120         &lt;screen android:screenSize="small" android:screenDensity="mdpi" />
    121         &lt;screen android:screenSize="small" android:screenDensity="hdpi" />
    122         &lt;screen android:screenSize="small" android:screenDensity="xhdpi" />
    123         &lt;!-- all normal size screens -->
    124         &lt;screen android:screenSize="normal" android:screenDensity="ldpi" />
    125         &lt;screen android:screenSize="normal" android:screenDensity="mdpi" />
    126         &lt;screen android:screenSize="normal" android:screenDensity="hdpi" />
    127         &lt;screen android:screenSize="normal" android:screenDensity="xhdpi" />
    128     &lt;/compatible-screens>
    129     &lt;application ... >
    130         ...
    131     &lt;application>
    132 &lt;/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
    140 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></dd>
    141 <dd><a href="{@docRoot}google/play/filters.html">Filters on Google Play</a></dd>
    142 </dl>
    143