• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=<supports-screens>
2parent.title=The AndroidManifest.xml File
3parent.link=manifest-intro.html
4@jd:body
5
6<dl class="xml">
7
8<dt>syntax:</dt>
9<dd>
10<pre class="stx">
11&lt;supports-screens android:<a href="#resizeable">resizeable</a>=["true"| "false"]
12                  android:<a href="#small">smallScreens</a>=["true" | "false"]
13                  android:<a href="#normal">normalScreens</a>=["true" | "false"]
14                  android:<a href="#large">largeScreens</a>=["true" | "false"]
15                  android:<a href="#xlarge">xlargeScreens</a>=["true" | "false"]
16                  android:<a href="#any">anyDensity</a>=["true" | "false"]
17                  android:<a href="#requiresSmallest">requiresSmallestWidthDp</a>="<em>integer</em>"
18                  android:<a href="#compatibleWidth">compatibleWidthLimitDp</a>="<em>integer</em>"
19                  android:<a href="#largestWidth">largestWidthLimitDp</a>="<em>integer</em>"/&gt;
20</pre>
21</dd>
22
23<dt>contained in:</dt>
24<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
25
26<dt>description:</dt>
27<dd itemprop="description">Lets you specify the screen sizes your application supports and enable <a
28href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> for screens
29larger than what your application supports. It's important that you always use this element in your
30application to specify the screen sizes your application supports.
31
32<p>An application "supports" a given screen size if it resizes properly to fill the entire screen.
33Normal resizing applied by the system works well for most applications and you don't have to do any
34extra work to make your application work on screens larger than a handset device. However, it's
35often important that you optimize your application's UI for different screen sizes by providing <a
36href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
37layout resources</a>. For instance, you might want to modify the layout of an activity
38when it is on a tablet compared to when running on a handset device.</p>
39
40<p>However, if your application does not work well when resized to fit different screen sizes, you
41can use the attributes of the {@code &lt;supports-screens&gt;} element to control whether your
42application should be distributed to smaller screens or have its UI scaled up ("zoomed") to fit
43larger screens using the system's <a
44href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a>. When you
45have not designed for larger screen sizes and the normal resizing does not achieve the appropriate
46results, screen compatibility mode will scale your UI by emulating a <em>normal</em> size
47screen and medium density, then zooming in so that it fills the entire screen. Beware that this
48causes pixelation and blurring of your UI, so it's better if you optimize your UI for large
49screens.</p>
50
51<p class="note"><strong>Note:</strong> Android 3.2 introduces new attributes: {@code
52android:requiresSmallestWidthDp}, {@code android:compatibleWidthLimitDp}, and {@code
53android:largestWidthLimitDp}. If you're developing your application for Android 3.2 and higher,
54you should use these attributes to declare your screen size support, instead of the attributes
55based on generalized screen sizes.</p>
56
57<p>For more information about how to properly support different screen sizes so that you can avoid
58using screen compatibility mode with your application, read
59<a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.</p>
60
61
62<dt>attributes:</dt>
63
64<dd>
65<dl class="attr">
66
67  <dt><a name="resizeable"></a>{@code android:resizeable}</dt>
68  <dd>Indicates whether the application is resizeable for different screen sizes. This attribute is
69true, by default. If set false, the system will run your application in <a
70href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> on large
71screens.</p>
72
73  <p><strong>This attribute is deprecated</strong>. It was introduced to help applications
74transition from Android 1.5 to 1.6, when support for multiple screens was first introduced. You
75should not use it.</p>
76  </dd>
77
78  <dt><a name="small"></a>{@code android:smallScreens}</dt>
79  <dd>Indicates whether the application supports smaller screen form-factors.
80     A small screen is defined as one with a smaller aspect ratio than
81     the "normal" (traditional HVGA) screen.  An application that does
82     not support small screens <em>will not be available</em> for
83     small screen devices from external services (such as Google Play), because there is little
84the platform can do to make such an application work on a smaller screen. This is {@code "true"} by
85default.
86  </dd>
87
88  <dt><a name="normal"></a>{@code android:normalScreens}</dt>
89  <dd>Indicates whether an application supports the "normal" screen
90     form-factors.  Traditionally this is an HVGA medium density
91     screen, but WQVGA low density and WVGA high density are also
92     considered to be normal.  This attribute is "true" by default.
93  </dd>
94
95  <dt><a name="large"></a>{@code android:largeScreens}</dt>
96  <dd>Indicates whether the application supports larger screen form-factors.
97     A large screen is defined as a screen that is significantly larger
98     than a "normal" handset screen, and thus might require some special care
99     on the application's part to make good use of it, though it may rely on resizing by the
100system to fill the screen.
101  <p>The default value for this actually varies between some versions, so it's better if
102you explicitly declare this attribute at all times. Beware that setting it "false" will
103generally enable <a href="{@docRoot}guide/practices/screen-compat-mode.html">screen
104compatibility mode</a>.</p>
105  </dd>
106
107  <dt><a name="xlarge"></a>{@code android:xlargeScreens}</dt>
108  <dd>Indicates whether the application supports extra large screen form-factors.
109     An xlarge screen is defined as a screen that is significantly larger
110     than a "large" screen, such as a tablet (or something larger) and may require special care
111     on the application's part to make good use of it, though it may rely on resizing by the
112system to fill the screen.
113  <p>The default value for this actually varies between some versions, so it's better if
114you explicitly declare this attribute at all times. Beware that setting it "false" will
115generally enable <a href="{@docRoot}guide/practices/screen-compat-mode.html">screen
116compatibility mode</a>.</p>
117     <p>This attribute was introduced in API level 9.</p>
118  </dd>
119
120  <dt><a name="any"></a>{@code android:anyDensity}</dt>
121  <dd>Indicates whether the application includes resources to accommodate any screen
122     density.
123     <p>For applications that support Android 1.6 (API level 4) and higher, this is "true"
124by default and <strong>you should not set it "false"</strong> unless you're absolutely certain that
125it's necessary for your application to work. The only time it might be necessary to disable this
126is if your app directly manipulates bitmaps (see the <a
127href="{@docRoot}guide/practices/screens_support.html#DensityConsiderations">Supporting Multiple
128Screens</a> document for more information).</p>
129  </dd>
130
131  <dt id="requiresSmallest">{@code android:requiresSmallestWidthDp}</dt>
132  <dd>Specifies the minimum smallestWidth required. The smallestWidth is the shortest dimension of
133the screen space (in {@code dp} units) that must be available to your application UI&mdash;that is,
134the shortest of the available screen's two dimensions. So, in order for a device to be considered
135compatible with your application, the device's smallestWidth must be equal to or greater than this
136value. (Usually, the value you supply for this is the "smallest width" that your layout supports,
137regardless of the screen's current orientation.)
138
139  <p>For example, a typical handset screen has a smallestWidth of 320dp, a 7" tablet has a
140smallestWidth of 600dp, and a 10" tablet has a smallestWidth of 720dp. These values are generally
141the smallestWidth because they are the shortest dimension of the screen's available space.</p>
142
143<p>The size against which your value is compared takes into account screen decorations and system
144UI. For example, if the device has some persistent UI elements on the display, the system declares
145the device's smallestWidth as one that is smaller than the actual screen size, accounting for these
146UI elements because those are screen pixels not available for your UI. Thus, the value you use
147should be the minimum width required by your layout, regardless of the screen's current
148orientation.</p>
149
150<p>If your application properly resizes for smaller screen sizes (down to the
151<em>small</em> size or a minimum width of 320dp), you do
152not need to use this attribute. Otherwise, you should use a value for this attribute that
153matches the smallest value used by your application for the <a
154href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">
155smallest screen width qualifier</a> ({@code sw&lt;N&gt;dp}).</p>
156
157  <p class="caution"><strong>Caution:</strong> The Android system does not pay attention to this
158attribute, so it does not affect how your application behaves at runtime. Instead, it is used
159to enable filtering for your application on services such as Google Play. However,
160<strong>Google Play currently does not support this attribute for filtering</strong> (on Android
1613.2), so you should continue using the other size attributes if your application does not support
162small screens.</p>
163
164<!--
165<p>Beginning with Android 3.2 (API level 13), using this attribute is the preferred way to
166specify the minimum screen size your application requires, instead of using the other attributes
167for small, normal, large, and xlarge screens. The advantage of using this attribute is that you
168have more control over exactly how much screen space your application needs at a minimum in order
169to properly display its UI, rather than relying on the generalized size groups.</p>
170<p>This attribute has no default value. If this attribute is not specified, then any of the old
171<code><a href="#small">smallScreens</a></code>, <code><a href="#normal">normalScreens</a></code>,
172<code><a href="#large">largeScreens</a></code>, or <code><a href="#xlarge">xlargeScreens</a></code>
173attributes are used instead to determine the smallest screen required.</p>
174-->
175     <p>This attribute was introduced in API level 13.</p>
176  </dd>
177
178  <dt id="compatibleWidth">{@code android:compatibleWidthLimitDp}</dt>
179  <dd>This attribute allows you to enable <a
180href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> as a
181user-optional feature by specifying the maximum "smallest screen width" for which your application
182is designed. If the smallest side of a device's available screen is greater than your value here,
183users can still install your application, but are offered to run it in screen compatibility mode. By
184default, screen compatibility mode is disabled and your layout is resized to fit the screen as
185usual, but a button is available in the system bar that allows the user to toggle screen
186compatibility mode on and off.
187  <p>If your application is compatible with all screen sizes and its layout properly resizes, you do
188not need to use this attribute.</p>
189  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode emulates only handset
190screens with a 320dp width, so screen compatibility mode is not applied if your value for {@code
191android:compatibleWidthLimitDp} is larger than 320.</p>
192     <p>This attribute was introduced in API level 13.</p>
193  </dd>
194
195  <dt id="largestWidth">{@code android:largestWidthLimitDp}</dt>
196  <dd>This attribute allows you to force-enable <a
197href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> by specifying
198the maximum "smallest screen width" for which your application is designed. If the smallest side of
199a device's available screen is greater than your value here, the application runs in screen
200compatibility mode with no way for the user to disable it.
201  <p>If your application is compatible with all screen sizes and its layout properly resizes, you do
202not need to use this attribute. Otherwise, you should first consider using the <a
203href="#compatibleWidth">{@code android:compatibleWidthLimitDp}</a> attribute. You should use the
204{@code android:largestWidthLimitDp} attribute only when your application is functionally broken when
205resized for larger screens and screen compatibility mode is the only way that users should use
206your application.</p>
207  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode emulates only handset
208screens with a 320dp width, so screen compatibility mode is not applied if your value for {@code
209android:largestWidthLimitDp} is larger than 320.</p>
210     <p>This attribute was introduced in API level 13.</p>
211  </dd>
212
213
214</dl></dd>
215
216<!-- ##api level indication## -->
217<dt>introduced in:</dt>
218<dd>API Level 4</dd>
219
220<dt>see also:</dt>
221<dd>
222  <ul>
223    <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
224Screens</a></li>
225    <li>{@link android.util.DisplayMetrics}</li>
226  </ul>
227</dd>
228
229</dl>
230