From 500cc4be2f81ff1d00a1dac97c351c30165a6139 Mon Sep 17 00:00:00 2001 From: Megha Joshi Date: Wed, 7 Mar 2012 16:09:05 -0800 Subject: [PATCH] A few updates for TVs. Change-Id: I2465cbfdfd3a5b9e22f94bd1c678aec33ab216d9 --- docs/html/training/multiscreen/screensizes.jd | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/html/training/multiscreen/screensizes.jd b/docs/html/training/multiscreen/screensizes.jd index 2db0b67bb9223..bf19b082d36e9 100644 --- a/docs/html/training/multiscreen/screensizes.jd +++ b/docs/html/training/multiscreen/screensizes.jd @@ -164,14 +164,14 @@ to implement these layouts, you could have the following files:

{@sample development/samples/training/multiscreen/newsreader/res/layout/onepane.xml all} -
  • 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.

    @@ -188,7 +188,7 @@ though they are all considered to be "large" screens. That's why Android introdu width given in dp. For example, the typical 7" tablet has a minimum width of 600 dp, so if you want your UI to have two panes on those screens (but a single list on smaller screens), you can use the same two layouts from the previous section for single -and two-pane layouts, but instead of the 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.

    @@ -222,20 +222,20 @@ you'll see a technique that allows you to avoid duplicating the layout files thi Therefore, you should also still use the abstract size bins (small, normal, large and xlarge) to be compatible with earlier versions. For example, if you want to design your UI so that it shows a single-pane UI on phones but a -multi-pane UI on 7" tablets and larger devices, you'd have to supply these +multi-pane UI on 7" tablets, TVs and other large devices, you'd have to supply these files:

    The 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:

    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:

    -{@sample development/samples/training/multiscreen/newsreader/res/values-xlarge-land/layouts.xml all} +

    res/values-large-land/layouts.xml:

    +{@sample development/samples/training/multiscreen/newsreader/res/values-large-land/layouts.xml all} -

    res/values-xlarge-port/layouts.xml:

    -{@sample development/samples/training/multiscreen/newsreader/res/values-xlarge-port/layouts.xml all} +

    res/values-large-port/layouts.xml:

    +{@sample development/samples/training/multiscreen/newsreader/res/values-large-port/layouts.xml all}