From 500cc4be2f81ff1d00a1dac97c351c30165a6139 Mon Sep 17 00:00:00 2001
From: Megha Joshi
res/layout-xlarge/main.xml, two-pane layout:
+ res/layout-large/main.xml, two-pane layout:
{@sample development/samples/training/multiscreen/newsreader/res/layout/twopanes.xml all}
Notice the xlarge qualifier in the directory name of the second layout. This layout
-will be selected on devices with screens classified as extra-large (for example, 10" tablets). The
+
Notice the large qualifier in the directory name of the second layout. This layout
+will be selected on devices with screens classified as large (for example, 7" tablets and above). The
other layout (without qualifiers) will be selected for smaller devices.
xlarge size qualifier, use
+and two-pane layouts, but instead of the large size qualifier, use
sw600dp to indicate the two-pane layout is for screens on which the smallest-width
is 600 dp:
@@ -209,9 +209,9 @@ while smaller screens will select the layout/main.xml (single-pane)
layout.
However, this won't work well on pre-3.2 devices, because they don't
-recognize sw600dp as a size qualifier, so you still have to use the xlarge
+recognize sw600dp as a size qualifier, so you still have to use the large
qualifier as well. So, you should have a file named
-res/layout-xlarge/main.xml
+res/layout-large/main.xml
which is identical to res/layout-sw600dp/main.xml. In the next section
you'll see a technique that allows you to avoid duplicating the layout files this way.
res/layout/main.xml: single-pane layoutres/layout-xlarge: multi-pane layoutres/layout-large: multi-pane layoutres/layout-sw600dp: multi-pane layoutThe last two files are identical, because one of them will be matched by -Android 3.2 devices, and the other one is for the benefit of tablets with +Android 3.2 devices, and the other one is for the benefit of tablets and TVs with earlier versions of Android.
-To avoid this duplication of the same file for tablets (and the maintenance +
To avoid this duplication of the same file for tablets and TVs (and the maintenance headache resulting from it), you can use alias files. For example, you can define the following layouts:
@@ -247,7 +247,7 @@ layouts:And add these two files:
res/values-xlarge/layout.xml:
+res/values-large/layout.xml:
<resources>
<item name="main" type="layout">@layout/main_twopanes</item>
@@ -267,9 +267,9 @@ layouts:
These latter two files have identical content, but they don’t actually define
the layout. They merely set up {@code main} to be an alias to {@code main_twopanes}. Since
-these files have xlarge and sw600dp selectors, they are
-applied to tablets regardless of Android version (pre-3.2 tablets match
-{@code xlarge}, and post-3.2 will match sw600dp).
+these files have large and sw600dp selectors, they are
+applied to tablets and TVs regardless of Android version (pre-3.2 tablets and TVs match
+{@code large}, and post-3.2 will match sw600dp).
Use Orientation Qualifiers
@@ -285,6 +285,7 @@ behaves in each screen size and orientation:
So each of these layouts is defined in an XML file in the @@ -319,11 +320,11 @@ all} {@sample development/samples/training/multiscreen/newsreader/res/values-sw600dp-port/layouts.xml all} -
res/values-xlarge-land/layouts.xml:
res/values-large-land/layouts.xml:
res/values-xlarge-port/layouts.xml:
res/values-large-port/layouts.xml: