• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Screen Compatibility Mode
2parent.title=Supporting Multiple Screens
3parent.link=screens_support.html
4
5@jd:body
6
7
8<div id="qv-wrapper">
9<div id="qv">
10
11<h2>In this document</h2>
12<ol>
13  <li><a href="#Disable">Disabling Screen Compatibility Mode</a></li>
14  <li><a href="#Enable">Enabling Screen Compatibility Mode</a></li>
15</ol>
16<h2>See also</h2>
17<ol>
18  <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
19  <li><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
20&lt;supports-screens&gt;}</a></li>
21</ol>
22</div>
23</div>
24
25<div class="figure" style="width:500px;">
26<a href="{@docRoot}images/screens_support/compat-zoom.png">
27<img src="{@docRoot}images/screens_support/compat-zoom-thumb.png" alt="" />
28</a>
29<p class="img-caption"><strong>Figure 1.</strong> An application running in compatibility mode
30on an Android 3.2 tablet.</p>
31</div>
32
33<div class="figure" style="width:500px;">
34<a href="{@docRoot}images/screens_support/compat-stretch.png">
35<img src="{@docRoot}images/screens_support/compat-stretch-thumb.png" alt="" />
36</a>
37<p class="img-caption"><strong>Figure 2.</strong> The same application from figure 1, with
38compatibility mode disabled.</p>
39</div>
40
41<p class="caution"><strong>Notice:</strong> If you've developed an application for a version of
42Android lower than Android 3.0, but it does resize properly for larger screens such as tablets, you
43should disable screen compatibility mode in order to maintain the best user experience. To learn how
44to quickly disable the user option, jump to <a href="#Disable">Disabling Screen Compatibility
45Mode</a>.</p>
46
47<p>Screen compatibility mode is an escape hatch for applications that are not properly designed
48to resize for larger screens such as tablets. Since Android 1.6, Android has supported a
49variety of screen sizes and does most of the work to resize application layouts so that they
50properly fit each screen. However, if your application does not successfully follow the guide to
51<a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>,
52then it might encounter some rendering issues on larger screens. For applications with this
53problem, screen compatibility mode can make the application a little more usable on larger
54screens.</p>
55
56<p>There are two versions of screen compatibility mode with slightly different behaviors:</p>
57<dl>
58  <dt>Version 1 (Android 1.6 - 3.1)</dt>
59  <dd>The system draws the application's UI in a "postage stamp"
60window. That is, the system draws the application's layout the same as it would on a
61normal size handset (emulating a 320dp x 480dp screen), with a black border that fills
62the remaining area of the screen.
63
64<p>This was introduced with Android 1.6 to handle apps that were designed only for the
65original screen size of 320dp x 480dp. Because there are so few active devices remaining that run
66Android 1.5, almost all applications should be developed against Android 1.6 or greater and
67should not have version 1 of screen compatibility mode enabled for larger screens. This version
68is considered obsolete.</p>
69  <p>To disable this version of screen compatibility mode, you simply need to set <a
70href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
71android:minSdkVersion}</a> or <a
72href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
73android:targetSdkVersion}</a> to {@code "4"} or higher, or set <a
74href="{@docRoot}guide/topics/manifest/supports-screens-element.html#resizeable">{@code
75android:resizeable}</a> to {@code "true"}.</p>
76  </dd>
77
78  <dt>Version 2 (Android 3.2 and greater)</dt>
79  <dd>The system draws the application's layout the same as
80it would on a normal size handset (approximately emulating a 320dp x 480dp screen), then scales it
81up to fill the screen. This essentially "zooms" in on your layout to make it bigger,
82which will usually cause artifacts such as blurring and pixelation in your UI.
83  <p>This was introduced with Android 3.2 to further
84assist applications on the latest tablet devices when the applications have not yet
85implemented techniques for <a
86href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
87Screens</a>.</p>
88  <p>In general, large screen devices running Android 3.2 or higher allow users to enable
89screen compatibility mode when the application does not <strong>explicitly declare that it supports
90large screens</strong> in the manifest file. When this is the case, an icon (with
91outward-pointing arrows) appears next to the clock in the system bar, which allows the user to
92toggle screen compatibility mode on and off (figure 3). An application can also explicitly
93declare that it <em>does not</em> support large screens such that screen compatibility mode
94is always enabled and the user cannot disable it. (How to declare your application's
95support for large screens is discussed in the following sections.)</p></dd>
96</dl>
97
98<img src="{@docRoot}images/screens_support/compat-toggle.png" alt="" />
99<p class="img-caption"><strong>Figure 3.</strong> The pop up menu to toggle screen compatibility
100mode (currently disabled, so normal resizing occurs).</p>
101
102<p>As a developer, you have control over when your application uses screen compatibility mode. The
103following sections describe how you can choose to disable or enable screen compatibility mode for
104larger screens when running Android 3.2 or higher.</p>
105
106
107<h2 id="Disable">Disabling Screen Compatibility Mode</h2>
108
109<p>If you've developed your application primarily for versions of Android lower than 3.0, but
110<strong>your application does resize properly</strong> for larger screens such as tablets,
111<strong>you should disable screen compatibility mode</strong> in order to maintain the best user
112experience. Otherwise, users may enable screen compatibility mode and experience your application in
113a less-than-ideal format.</p>
114
115<p>By default, screen compatibility mode for devices running Android 3.2 and higher is offered to
116users as an optional feature when one of the following is true:</p>
117
118<ul>
119  <li>Your application has set both <a
120href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
121and <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
122android:targetSdkVersion}</a> to {@code "10"} or lower and <strong>does not explicitly
123declare support</strong> for large screens using the <a
124href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
125&lt;supports-screens&gt;}</a> element.</li>
126
127  <li>Your application has set either <a
128href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
129or <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
130android:targetSdkVersion}</a> to {@code "11"} or higher and <strong>explicitly declares that it does
131not support</strong> large screens, using the <a
132href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
133&lt;supports-screens&gt;}</a> element.</li>
134</ul>
135
136<p>To completely disable the user option for screen compatibility mode and remove the icon in the
137system bar, you can do one of the following:</p>
138
139<ul>
140  <li><strong>Easiest:</strong>
141    <p>In your manifest file, add the <a
142href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
143&lt;supports-screens&gt;}</a> element and specify the <a
144href="{@docRoot}guide/topics/manifest/supports-screens-element.html#xlarge">{@code
145android:xlargeScreens}</a> attribute to {@code "true"}:</p>
146<pre>
147&lt;supports-screens android:xlargeScreens="true" /&gt;
148</pre>
149  <p>That's it. This declares that your application supports all larger screen sizes, so the
150system will always resize your layout to fit the screen. This works regardless of what values
151you've set in the <a
152href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
153attributes.</p>
154  </li>
155
156  <li><strong>Easy but has other effects:</strong>
157    <p>In your manifest's <a
158href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
159element, set <a
160href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
161android:targetSdkVersion}</a> to {@code "11"} or higher:</p>
162<pre>
163&lt;uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" /&gt;
164</pre>
165  <p>This declares that your application supports Android 3.0 and, thus, is designed to
166work on larger screens such as tablets.</p>
167  <p class="caution"><strong>Caution:</strong> When running on Android 3.0 and greater, this also
168has the effect of enabling the Holographic theme for you UI, adding the <a
169href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> to your activities, and removing the
170Options Menu button in the system bar.</p>
171  <p>If screen compatibility mode is still enabled after you change this, check your manifest's <a
172href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
173&lt;supports-screens&gt;}</a> and be sure that there are no attributes set {@code "false"}. The best
174practice is to always explicitly declare your support for different screen sizes using the <a
175href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
176&lt;supports-screens&gt;}</a> element, so you should use this element anyway.</p>
177  <p>For more information about updating your application to target Android 3.0 devices, read <a
178href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android
1793.0</a>.</p>
180  </li>
181<!--
182  <li><strong>Most control</strong> (but you must compile against Android 3.2 or higher):
183    <p>In your manifest file, add the <a
184href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
185&lt;supports-screens&gt;}</a> element and specify the {@code android:compatibleWidthLimitDp}
186attribute to any value <em>higher than</em> {@code "320"}:</p>
187<pre>
188&lt;supports-screens android:compatibleWidthLimitDp="720" /&gt;
189</pre>
190  <p>Using this technique allows you to specify exactly what your application's limit is for
191layout resizing. Normally, only applications that are already built against Android 3.2 (or
192higher) use this attribute, because the primary intention is to specify at what size should screen
193compatibility mode actually be offered to users.</p>
194  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates
195handset screens with a 320dp width, so screen compatibility mode is not applied to any device if
196your value for {@code android:compatibleWidthLimitDp} is larger than 320.</p>
197  </li>
198  -->
199</ul>
200
201
202
203<h2 id="Enable">Enabling Screen Compatibility Mode</h2>
204
205<p>When your application is targeting Android 3.2 (API level 13) or higher, you can affect
206whether compatibility mode is enabled for certain screens by using the <a
207href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
208&lt;supports-screens>}</a> element.</p>
209
210<p class="note"><strong>Note:</strong> Screen compatibility mode is <strong>not</strong> a mode in
211which you should want your application to run&mdash;it causes pixelation and blurring in your UI,
212due to zooming. The proper way to make your application work well on large screens is to follow the
213guide to <a
214href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a> and
215provide alternative layouts for different screen sizes.</p>
216
217<p>By default, when you've set either <a
218href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
219android:minSdkVersion}</a> or <a
220href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
221android:targetSdkVersion}</a> to {@code "11"} or higher, screen compatibility mode is
222<strong>not</strong> available to users. If either of these are true and your application does not
223resize properly for larger screens, you can choose to enable screen compatibility mode in one
224of the following ways:</p>
225
226<ul>
227  <li>In your manifest file, add the <a
228href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
229&lt;supports-screens&gt;}</a> element and specify the <a
230href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">{@code
231android:compatibleWidthLimitDp}</a> attribute to {@code "320"}:</p>
232<pre>
233&lt;supports-screens android:compatibleWidthLimitDp="320" /&gt;
234</pre>
235  <p>This indicates that the maximum "smallest screen width" for which your application is designed
236is 320dp. This way, any devices with their smallest side being larger than this value will offer
237screen compatibility mode as a user-optional feature.</p>
238  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates
239handset screens with a 320dp width, so screen compatibility mode is not applied to any device if
240your value for <a
241href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">{@code
242android:compatibleWidthLimitDp}</a> is larger than 320.</p>
243  </li>
244
245  <li>If your application is functionally broken when resized for large screens and you want to
246force users into screen compatibility mode (rather than simply providing the option), you can use
247the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html#largestWidth">{@code
248android:largestWidthLimitDp}</a> attribute:
249<pre>
250&lt;supports-screens android:largestWidthLimitDp="320" /&gt;
251</pre>
252  <p>This works the same as <a
253href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">{@code
254android:compatibleWidthLimitDp}</a> except it force-enables
255screen compatibility mode and does not allow users to disable it.</p>
256  </li>
257</ul>