summaryrefslogtreecommitdiffstats
path: root/docs/html/guide/topics/manifest/supports-screens-element.jd
blob: 605a2bb482e1412dff254515d4310c42a3719ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
page.title=<supports-screens>
parent.title=The AndroidManifest.xml File
parent.link=manifest-intro.html
@jd:body

<dl class="xml">

<dt>syntax:</dt>
<dd>
<pre class="stx">
&lt;supports-screens android:<a href="#requiresSmallest">requiresSmallestWidthDp</a>="<em>integer</em>"
                  android:<a href="#compatibleWidth">compatibleWidthLimitDp</a>="<em>integer</em>"
                  android:<a href="#largestWidth">largestWidthLimitDp</a>="<em>integer</em>"
                  android:<a href="#resizeable">resizeable</a>=["true"| "false"]
                  android:<a href="#small">smallScreens</a>=["true" | "false"]
                  android:<a href="#normal">normalScreens</a>=["true" | "false"]
                  android:<a href="#large">largeScreens</a>=["true" | "false"]
                  android:<a href="#xlarge">xlargeScreens</a>=["true" | "false"]
                  android:<a href="#any">anyDensity</a>=["true" | "false"]  /&gt;
</pre>
</dd>

<dt>contained in:</dt>
<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>

<dt>description:</dt>
<dd>Lets you specify the screen sizes your application supports and enable screen
compatibility mode for screens larger than what your application supports. By default, a modern
application (using API Level 4 or higher) supports all screen sizes; older applications are assumed
to support only the "normal" screen size. Screen size is determined by the number of pixels on the
screen after the system accounts for screen density scaling.

<p>An application "supports" a given screen size if it resizes properly to fill the entire screen.
By default, the system resizes your application UI to fill the screen if you have set
either <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
minSdkVersion}</a> or <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
targetSdkVersion}</a> to {@code "4"} or higher. Normal resizing works well for most applications and
you don't have to do any extra work to make your application work on screens larger than a
handset device.</p>

<p>In addition to allowing the system to resize your application to fit the current screen, you can
optimize your UI for different screen sizes by providing <a
href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
layout resources</a> for different sizes. For instance, you might want to modify the layout
of an activity when it is on a tablet or similar device that has an <em>xlarge</em> screen.</p>

<p>However, if your application does not work well when resized to fit different screen sizes,
you can use the attributes of the {@code &lt;supports-screens&gt;} element to control whether
your application should be distributed to smaller screens or have its UI scaled up to fit larger
screens using the system's screen compatibility mode. When you have not designed for larger screen
sizes and the normal resizing does not achieve the appropriate results, <em>screen compatibility
mode</em> will scale your UI by emulating a <em>normal</em> size screen and then zooming in on it so
that it fills the entire screen&mdash;thus achieving the same layout as a normal handset device on
the large screen (but this usually causes pixelation and blurring of your UI).</p>

<p>For more information about how to properly support different screen sizes so that you can avoid
using screen compatibility mode, read
<a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.</p>


<dt>attributes:</dt>

<dd>
<dl class="attr">
  
  <dt id="requiresSmallest">{@code android:requiresSmallestWidthDp}</dt>
  <dd>This attribute specifies the minimum "smallest screen width" with which your
application is compatible. In order for a device to be considered compatible with your
application, the shortest side of the available screen space must be equal to or greater than this
value.
<p>The width against which your value is compared takes into account screen decorations and system
UI. For example, if the device has some persistent UI elements on the left or right edge of the
display, the system declares the device's available width as one that is smaller than the actual
screen size, accounting for these UI elements because those are screen pixels not available for your
UI. Thus, the value you use should be the actual smallest width required by your layout.</p>
<p>If your application properly resizes for smaller screen sizes (down to the
<em>small</em> size or a minimum width of 320dp), you do
not need to use this attribute. Otherwise, you should use a value for this attribute that
matches the smallest value used by your application for the <a
href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">
smallest screen width qualifier</a> ({@code sw&lt;N&gt;dp}).</p>

<p>For example, a typical handset screen has a minimum width of 320dp, a 7" tablet has a minimum
width of 600dp, and a 10" tablet has a minimum width of 720dp. If the smallest available screen
width on a device is less than the value you supply here, then the application is considered
incompatible with that
device. External services such as Android Market use this to determine whether a device
is compatible with your application and prevent incompatible devices from installing it.</p>
<p>Beginning with Android 3.2 (API level 13), using this attribute is the preferred way to
specify the minimum screen size your application requires, instead of using the other attributes
for small, normal, large, and xlarge screens. The advantage of using this attribute is that you
have more control over exactly how much screen space your application needs at a minimum in order
to properly display its UI, rather than relying on the generalized size groups.</p>
<p>This attribute has no default value. If this attribute is not specified, then any of the old
<code><a href="#small">smallScreens</a></code>, <code><a href="#normal">normalScreens</a></code>,
<code><a href="#large">largeScreens</a></code>, or <code><a href="#xlarge">xlargeScreens</a></code>
attributes are used instead to determine the smallest screen required.</p>
     <p>This attribute was introduced in API level 13.</p>
  </dd>

  <dt id="compatibleWidth">{@code android:compatibleWidthLimitDp}</dt>
  <dd>This attribute allows you to enable screen compatibility mode as a user-optional feature by
specifying the maximum "smallest screen width" for which your application is designed. If the value
you supply here is less than the shortest side of the available screen space, users can still
install your application, but are offered to run it in screen compatibility mode. By default, screen
compatibility mode is disabled and your layout is resized to fit the screen as usual, but a
button is available in the system bar that allows the user to toggle screen compatibility mode on
and off.
  <p>If your application is compatible with all screen sizes and its layout properly resizes, you do
not need to use this attribute.</p>
  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates handset
screens with a 320dp width, so screen compatibility mode is not applied if your value for {@code
android:compatibleWidthLimitDp} is larger than 320.</p>
     <p>This attribute was introduced in API level 13.</p>
  </dd>

  <dt id="largestWidth">{@code android:largestWidthLimitDp}</dt>
  <dd>This attribute allows you to force enable screen compatibility mode by specifying the maximum
"smallest screen width" for which your application is designed. If the value you supply here is less
than the shortest side of the available screen space, the application runs in screen
compatibility mode with no way for the user to disable it.
  <p>If your application is compatible with all screen sizes and its layout properly resizes, you do
not need to use this attribute. Otherwise, you should first consider using the <a
href="#compatibleWidth">{@code android:compatibleWidthLimitDp}</a> attribute. You should use the
{@code android:largestWidthLimitDp} attribute only when your application is functionally broken when
resized for larger screens and screen compatibility mode is the only way that users should use
your application.</p>
  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates handset
screens with a 320dp width, so screen compatibility mode is not applied if your value for {@code
android:largestWidthLimitDp} is larger than 320.</p>
     <p>This attribute was introduced in API level 13.</p>
  </dd>

  <dt><a name="resizeable"></a>{@code android:resizeable}</dt>
  <dd>Indicates whether the application is resizeable for different screen sizes. This attribute is
true, by default, if you have set either <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
{@code "4"} or higher. Otherwise, it is false by default. If set false, the system will not resize
your application when run on <em>large</em> or <em>xlarge</em> screens. Instead, the
application appears in a "postage stamp" that equals the <em>normal</em> screen size that your
application does support. This is less than an ideal experience for users, because the
application appears smaller than the available screen, but it might help your application run
normally if it were designed only for the <em>normal</em> screen size and some behaviors do not work
when resized.</p>
  <p>To provide the best experience on all screen sizes, you should allow resizing and, if your
application does not work well on larger screens, follow the guide to <a
href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a> to enable
additional screen support.</p>
  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
  </dd>
  
  
  <dt><a name="small"></a>{@code android:smallScreens}</dt>
  <dd>Indicates whether the application supports smaller screen form-factors.
     A small screen is defined as one with a smaller aspect ratio than
     the "normal" (traditional HVGA) screen.  An application that does
     not support small screens <em>will not be available</em> for
     small screen devices from external services (such as Android Market), because there is little
the platform can do
     to make such an application work on a smaller screen. If the application has set either <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
{@code "4"} or higher,
the default value for this is {@code "true"}, any value less than {@code "4"} results in this set to
{@code "false"}.
  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
  </dd>
  
  <dt><a name="normal"></a>{@code android:normalScreens}</dt>
  <dd>Indicates whether an application supports the "normal" screen
     form-factors.  Traditionally this is an HVGA medium density
     screen, but WQVGA low density and WVGA high density are also
     considered to be normal.  This attribute is "true" by default,
     and applications currently should leave it that way.
  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
  </dd>
  
  <dt><a name="large"></a>{@code android:largeScreens}</dt>
  <dd>Indicates whether the application supports larger screen form-factors.
     A large screen is defined as a screen that is significantly larger
     than a "normal" handset screen, and thus might require some special care
     on the application's part to make good use of it, though it may rely on resizing by the
system to fill the screen. If the application has set either <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
{@code "4"} or higher,
the default value for this is {@code "true"}, any value less than {@code "4"} results in this set to
{@code "false"}.
  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
  </dd>

  <dt><a name="xlarge"></a>{@code android:xlargeScreens}</dt>
  <dd>Indicates whether the application supports extra large screen form-factors.
     An xlarge screen is defined as a screen that is significantly larger
     than a "large" screen, such as a tablet (or something larger) and may require special care
     on the application's part to make good use of it, though it may rely on resizing by the
system to fill the screen. If the application has set either <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
{@code "4"} or higher,
the default value for this is {@code "true"}, any value less than {@code "4"} results in this set to
{@code "false"}.
     <p>This attribute was introduced in API level 9.</p>
  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
  </dd>
  
  <dt><a name="any"></a>{@code android:anyDensity}</dt>
  <dd>Indicates whether the application includes resources to accommodate any screen
     density.  Older applications (before API Level 4) are assumed unable to
     accomodate all densities and this is {@code "false"} by default. If the application has set
either <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
{@code "4"} or higher,
the default value for this is {@code "true"}. Otherwise, it is {@code "false"}.
     You can explicitly supply your abilities here.
     <p>Based on the "standard" device screen density (medium dpi), the Android framework will scale
down application assets by a factor of 0.75 (low dpi screens) or scale them up by a factor of 1.5
(high dpi screens), when you don't provide alternative resources for a specifc screen density. The
screen density is expressed as dots-per-inch (dpi).</p>
  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
  </dd>
  

</dl></dd>

<!-- ##api level indication## -->
<dt>introduced in:</dt>
<dd>API Level 4</dd>

<dt>see also:</dt>
<dd>
  <ul>
    <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
Screens</a></li>
    <li>{@link android.util.DisplayMetrics}</li>
  </ul>
</dd>

</dl>