Skip to content

Commit 5e44f68

Browse files
committed
docs: add guide for optimizing tablet apps for handsets
deprecate "optimizing for 3.0" doc Change-Id: I290ff5cd22c714e639fb820251c9e1d763f750df
1 parent a6d2e6b commit 5e44f68

File tree

9 files changed

+3123
-23
lines changed

9 files changed

+3123
-23
lines changed

docs/html/guide/guide_toc.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,9 @@ localized titles are added in the language order specified below.
715715
</a></li>
716716
</ul>
717717
</li>
718-
<li><a href="<?cs var:toroot ?>guide/practices/optimizing-for-3.0.html">
719-
<span class="en">Optimizing Apps for Android 3.0</span>
720-
</a></li>
718+
<li><a href="<?cs var:toroot ?>guide/practices/tablets-and-handsets.html">
719+
<span class="en">Supporting Tablets and Handsets</span>
720+
</a> <span class="new">new!</span></li>
721721
<li class="toggle-list">
722722
<div><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/index.html">
723723
<span class="en">UI Guidelines</span>

docs/html/guide/practices/optimizing-for-3.0.jd

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
page.title=Optimizing Apps for Android 3.0
22
@jd:body
33

4+
5+
<div id="deprecatedSticker">
6+
<a href="#"
7+
onclick="$('#naMessage').show();$('#deprecatedSticker').hide();return false">
8+
<strong>This doc is deprecated</strong></a>
9+
</div>
10+
11+
12+
<div id="naMessage" style="display:block">
13+
<div><p><strong>This document has been deprecated.</strong></p>
14+
<p>To learn about how you can optimize your app for both tablets and handsets, please
15+
read the guide to <a href="tablets-and-handsets.html">Supporting Tablets and
16+
Handsets</a>.</p>
17+
18+
<input style="margin-top:1em;padding:5px" type="button"
19+
value="That's nice, but I still want to read this document"
20+
onclick="$('#naMessage').hide();$('#deprecatedSticker').show()" />
21+
</div>
22+
</div>
23+
24+
25+
26+
27+
28+
429
<div id="qv-wrapper">
530
<div id="qv">
631
<h2>In this document</h2>
@@ -25,6 +50,8 @@ page.title=Optimizing Apps for Android 3.0
2550
<h2>See also</h2>
2651

2752
<ol>
53+
<li><a href="tablets-and-handsets.html">Supporting Tablets
54+
and Handsets</a></li>
2855
<li><a
2956
href="{@docRoot}sdk/compatibility-library.html">Compatibility Library</a></li>
3057
<li><a href="http://code.google.com/p/iosched/">Google I/O App source code</a></li>

docs/html/guide/practices/screens-distribution.jd

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ screen configuration</li>
1515

1616
<h2>In this document</h2>
1717
<ol>
18-
<li><a href="#FilteringHansetApps">Filtering a Handset Application from Tablets</a></li>
19-
<li><a href="#FilteringTabletApps">Filtering a Tablet Application from Handsets</a></li>
18+
<li><a href="#FilteringHansetApps">Declaring an App is Only for Handsets</a></li>
19+
<li><a href="#FilteringTabletApps">Declaring an App is Only for Tablets</a></li>
2020
<li><a href="#MultiApks">Publishing Multiple APKs for Different Screens</a></li>
2121
</ol>
2222

@@ -48,7 +48,7 @@ available to the greatest number of users with different devices, using a single
4848

4949

5050

51-
<h2 id="FilteringHandsetApps">Filtering a Handset Application from Tablets</h2>
51+
<h2 id="FilteringHandsetApps">Declaring an App is Only for Handsets</h2>
5252

5353
<p>Because the system generally scales applications to fit larger screens well, you shouldn't
5454
need to filter your application from larger screens. As long as you follow the <a
@@ -79,7 +79,6 @@ entry looks like if your application is compatible with only small and normal sc
7979

8080
<pre>
8181
&lt;manifest ... >
82-
...
8382
&lt;compatible-screens>
8483
&lt;!-- all small size screens -->
8584
&lt;screen android:screenSize="small" android:screenDensity="ldpi" />
@@ -92,6 +91,7 @@ entry looks like if your application is compatible with only small and normal sc
9291
&lt;screen android:screenSize="normal" android:screenDensity="hdpi" />
9392
&lt;screen android:screenSize="normal" android:screenDensity="xhdpi" />
9493
&lt;/compatible-screens>
94+
...
9595
&lt;application ... >
9696
...
9797
&lt;application>
@@ -108,36 +108,66 @@ to specify each screen density your application supports.</p>
108108

109109

110110

111-
<h2 id="FilteringTabletApps">Filtering a Tablet Application from Handsets</h2>
112111

113-
<p>If your application's UI is adversely affected when the system scales your application down to
114-
smaller screens, you should add <a
115-
href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
116-
layouts</a> for smaller screens to adjust the layout for those screens. However, sometimes your
117-
layout still might not fit a smaller screen or you've explicitly designed your application only for
118-
tablets and other large devices. In this case, you can manage the availability of your application
119-
to smaller screens by using the <a
112+
<h2 id="FilteringTabletApps">Declaring an App is Only for Tablets</h2>
113+
114+
<p>If you don't want your app to be used on handsets (perhaps your app truly makes sense only on a
115+
large screen) or you need time to optimize it for smaller screens, you can prevent small-screen
116+
devices from downloading your app by using the <a
120117
href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
121118
&lt;supports-screens>}</a> manifest element.</p>
122119

123-
<p>For example, if you want your application to be available only to large and extra large
124-
screens, you can declare the element in your manifest like this:</p>
120+
<p>For example, if you want your application to be available only to tablet devices, you can declare
121+
the element in your manifest like this:</p>
125122

126123
<pre>
127124
&lt;manifest ... >
128-
...
129125
&lt;supports-screens android:smallScreens="false"
130126
android:normalScreens="false"
131127
android:largeScreens="true"
132-
android:xlargeScreens="true" /&gt;
128+
android:xlargeScreens="true"
129+
android:requiresSmallestWidthDp="600" />
130+
...
133131
&lt;application ... >
134132
...
135-
&lt;application>
133+
&lt;/application>
136134
&lt;/manifest>
137135
</pre>
138136

139-
<p>External services such as Android Market read this manifest element and use it to ensure that
140-
your application is available only to devices with either a large or an extra large screen.</p>
137+
<p>This describes your app's screen-size support in two different ways:</p>
138+
139+
<ul>
140+
<li>It declares that the app does <em>not</em> support the screen sizes "small" and
141+
"normal", which are traditionally not tablets.</li>
142+
<li>It declares that the app requires a screen size with a minimum usable area that is at least
143+
600dp wide.</li>
144+
</ul>
145+
146+
<p>The first technique is for devices that are running Android 3.1 or older, because those devices
147+
declare their size based on generalized screen sizes. The <a
148+
href="{@docRoot}guide/topics/manifest/supports-screens-element.html#requiresSmallest">{@code
149+
requiresSmallestWidthDp}</a> attribute is for devices running Android 3.2 and newer, which includes
150+
the capability for apps to specify size requirements based on a minimum number of
151+
density-independent pixels available. In this example, the app declares a minimum width requirement
152+
of 600dp, which generally implies a 7"-or-greater screen. </p>
153+
154+
<p>Your size choice might be different, of course, based on how well your design works on different
155+
screen sizes; for example, if your design works well only on screens that are 9" or larger, you
156+
might require a minimum width of 720dp.</p>
157+
158+
<p>The catch is that you must compile your application against Android 3.2 or higher in order to use
159+
the <code>requiresSmallestWidthDp</code> attribute. Older versions don't understand this attribute
160+
and will raise a compile-time error. The safest thing to do is develop your app against the platform
161+
that matches the API level you've set for <a
162+
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">minSdkVersion</a
163+
>. When you're making final preparations to build your release candidate, change the build target to
164+
Android 3.2 and add the <code>requiresSmallestWidthDp</code> attribute. Android versions older than
165+
3.2 simply ignore that XML attribute, so there's no risk of a runtime failure.</p>
166+
167+
<p>For more information about why the "smallest width" screen size is
168+
important for supporting different screen sizes, read <a
169+
href="http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html">New
170+
Tools for Managing Screen Sizes</a>.</p>
141171

142172
<p class="caution"><strong>Caution:</strong> If you use the <a
143173
href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
@@ -151,7 +181,7 @@ information). If you want
151181
to prevent your application from being downloaded on larger screens, use <a
152182
href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
153183
&lt;compatible-screens>}</a>, as discussed in the previous section about <a
154-
href="#FilteringHandsetApps">Filtering a Handset Application from Tablets</a>.</p>
184+
href="#FilteringHandsetApps">Declaring an App is Only for Handsets</a>.</p>
155185

156186
<p>Remember, you should strive to make your application available to as many devices as possible by
157187
applying all necessary techniques for <a

docs/html/guide/practices/screens_support.jd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Resolutions</a></li>
5050
<h2>See also</h2>
5151
<ol>
5252
<li><a
53+
href="http://android-developers.blogspot.com/2011/09/thinking-like-web-designer.html">Thinking
54+
Like a Web Designer</a></li>
55+
<li><a
5356
href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">
5457
Providing Alternative Resources</a></li>
5558
<li><a href="{@docRoot}guide/practices/ui_guidelines/icon_design.html">Icon Design

0 commit comments

Comments
 (0)