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 itemprop="description">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 specific screen configurations. Instead of using this
     41 element, you should follow the guide to <a href=
     42 "{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a> to
     43 provide scalable support for multiple screens using alternative layouts and bitmaps
     44 for different screen sizes and densities.</p>
     45 
     46   <p>If you want to set only a minimum screen <em>size</em> for your your application, then you
     47 should use the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
     48 &lt;supports-screens&gt;}</a> element. For example, if you want your application to be available
     49 only for <em>large</em> and <em>xlarge</em> screen devices, the <a
     50 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
     51 &lt;supports-screens&gt;}</a> element allows you to declare that your application does not
     52 support <em>small</em> and <em>normal</em> screen sizes. External services (such as Google
     53 Play) will filter your application accordingly. You can also use the <a
     54 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
     55 &lt;supports-screens&gt;}</a> element to declare whether the system should resize your
     56 application for different screen sizes.</p>
     57 
     58   <p>Also see the <a href="{@docRoot}google/play/filters.html">Filters on Google Play</a>
     59 document for more information about how Google Play filters applications using this and
     60 other manifest elements.</p>
     61 
     62 </dd>
     63 
     64 <dt>child elements:</dt>
     65 <dd>
     66   <dl class="tag-list">
     67 
     68     <dt id="screen">{@code &lt;screen&gt;}</dt>
     69     <dd>Specifies a single screen configuration with which the application is compatible.
     70       <p>At least one instance of this element must be placed inside the {@code
     71 &lt;compatible-screens&gt;} element. This element <em>must include both</em> the {@code
     72 android:screenSize} and {@code android:screenDensity} attributes (if you do not declare both
     73 attributes, then the element is ignored).</p>
     74 
     75       <p class="caps">attributes:</p>
     76       <dl class="atn-list">
     77         <dt id="screenSize"><code>android:screenSize</code></dt>
     78         <dd><b>Required.</b> Specifies the screen size for this screen configuration.
     79           <p>Accepted values:</p>
     80           <ul>
     81             <li>{@code small}</li>
     82             <li>{@code normal}</li>
     83             <li>{@code large}</li>
     84             <li>{@code xlarge}</li>
     85           </ul>
     86           <p>For information about the different screen sizes, see <a
     87 href="{@docRoot}guide/practices/screens_support.html#range">Supporting Multiple Screens</a>.</p>
     88         </dd>
     89         <dt id="screenDensity"><code>android:screenDensity</code></dt>
     90         <dd><b>Required.</b> Specifies the screen density for this screen configuration.
     91           <p>Accepted values:</p>
     92           <ul>
     93             <li>{@code ldpi}</li>
     94             <li>{@code mdpi}</li>
     95             <li>{@code hdpi}</li>
     96             <li>{@code xhdpi}</li>
     97           </ul>
     98           <p class="note"><strong>Note:</strong> This attribute currently does not accept
     99           {@code xxhdpi} as a valid value, but you can instead specify {@code 480}
    100           as the value, which is the approximate threshold for xhdpi screens.</p>
    101 
    102           <p>For information about the different screen densities, see <a
    103 href="{@docRoot}guide/practices/screens_support.html#range">Supporting Multiple Screens</a>.</p>
    104         </dd>
    105       </dl>
    106     </dd>
    107   </dl>
    108 </dd>
    109 
    110 <dt>example</dt>
    111 <dd>
    112 <p>If your application is compatible with only small and normal screens, regardless
    113 of screen density, then you must specify eight different {@code &lt;screen&gt;} elements,
    114 because each screen size has four different density configurations. You must declare each one of
    115 these; any combination of size and density that you do <em>not</em> specify is considered a screen
    116 configuration with which your application is <em>not</em> compatible. Here's what the manifest
    117 entry looks like if your application is compatible with only small and normal screens:</p>
    118 
    119 <pre>
    120 &lt;manifest ... >
    121     ...
    122     &lt;compatible-screens>
    123         &lt;!-- all small size screens -->
    124         &lt;screen android:screenSize="small" android:screenDensity="ldpi" />
    125         &lt;screen android:screenSize="small" android:screenDensity="mdpi" />
    126         &lt;screen android:screenSize="small" android:screenDensity="hdpi" />
    127         &lt;screen android:screenSize="small" android:screenDensity="xhdpi" />
    128         &lt;!-- all normal size screens -->
    129         &lt;screen android:screenSize="normal" android:screenDensity="ldpi" />
    130         &lt;screen android:screenSize="normal" android:screenDensity="mdpi" />
    131         &lt;screen android:screenSize="normal" android:screenDensity="hdpi" />
    132         &lt;screen android:screenSize="normal" android:screenDensity="xhdpi" />
    133     &lt;/compatible-screens>
    134     &lt;application ... >
    135         ...
    136     &lt;application>
    137 &lt;/manifest>
    138 </pre>
    139 </dd>
    140 
    141 <dt>introduced in:</dt>
    142 <dd>API Level 9</dd>
    143 <dt>see also:</dt>
    144 <dd><a
    145 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></dd>
    146 <dd><a href="{@docRoot}google/play/filters.html">Filters on Google Play</a></dd>
    147 </dl>
    148