blob: 6071ef3ccd9db24e4b160b4f268694e25afcc909 [file] [log] [blame]
Roman Nurikb99ae732012-03-06 12:26:15 -08001page.title=Multi-pane Layouts
Scott Maine21406c2013-03-18 15:50:55 -07002page.tags="tablet","navigation","layout","fragment"
Dirk Dougherty31558252014-02-08 20:29:06 -08003page.metaDescription=Android devices come in many different screen sizes and types. Multi-pane layouts help you provide a balanced and aesthetically pleasing layout across the range of Android devices.
Roman Nurikb99ae732012-03-06 12:26:15 -08004@jd:body
5
Scott Maincbcd17d2013-05-14 08:46:55 -07006<a class="notice-developers" href="{@docRoot}training/basics/fragments/index.html">
7 <div>
8 <h3>Developer Docs</h3>
9 <p>Building a Dynamic UI with Fragments</p>
10 </div>
11</a>
12
Dirk Dougherty31558252014-02-08 20:29:06 -080013<p>When writing an app for Android, keep in mind that Android devices
14come in many different screen sizes and types. Make sure that your app consistently provides a
15balanced and aesthetically pleasing layout by adjusting its content to varying screen sizes and
16orientations.</p>
17
Roman Nurikb99ae732012-03-06 12:26:15 -080018<p><em>Panels</em> are a great way for your app to achieve this. They allow you to combine multiple views into
19one compound view when a lot of horizontal screen real estate is available and by splitting them up
20when less space is available.</p>
21<h2 id="combining-views">Combining Multiple Views Into One</h2>
22
23<p>On smaller devices your content is typically divided into a master grid or list view and a detail
24view. Touching an item in the master view opens a different screen showing that item's detail
25information.</p>
26
27<img src="{@docRoot}design/media/multipane_views.png">
28
29<p>Because tablets have more screen real estate than phones, you can use panels to combine the related
30list and detail views into a single compound view. This uses the additional space more efficiently
31and makes navigating the app easier. </p>
32
33<img src="{@docRoot}design/media/multipane_view_tablet.png">
34
35<p>In general, use the pane on the right to present more information about the item you selected in the
36left pane. Make sure to keep the item in the left pane selected in order to establish the
37relationship between the panels.</p>
38<h2 id="orientation">Compound Views and Orientation Changes</h2>
39
Peter Ng252d23d2012-08-07 20:19:10 -070040<p>Screens should strive to have the same functionality regardless of orientation. If you use a compound view in
41one orientation, try not to split it up when the user rotates the screen. There are several techniques
Roman Nurikb99ae732012-03-06 12:26:15 -080042you can use to adjust the layout after orientation change while keeping functional parity intact.</p>
43
44<div class="layout-content-row">
45 <div class="layout-content-col span-8">
46
47 <img src="{@docRoot}design/media/multipane_stretch.png">
48
49 </div>
50 <div class="layout-content-col span-5">
51
52<h4>Stretch/compress</h4>
53<p>Adjust the column width of your left pane to achieve a balanced layout in both orientations.</p>
54
55 </div>
56</div>
57
58<div class="layout-content-row">
59 <div class="layout-content-col span-8">
60
61 <img src="{@docRoot}design/media/multipane_stack.png">
62
63 </div>
64 <div class="layout-content-col span-5">
65
66<h4>Stack</h4>
67<p>Rearrange the panels on your screen to match the orientation.</p>
68
69 </div>
70</div>
71
72<div class="layout-content-row">
73 <div class="layout-content-col span-8">
74
75 <img src="{@docRoot}design/media/multipane_expand.png">
76
77 </div>
78 <div class="layout-content-col span-5">
79
80<h4>Expand/collapse</h4>
Peter Ng02123632012-08-06 11:44:48 -070081<p>When the device rotates, collapse the left pane view to only show the most important information.</p>
Roman Nurikb99ae732012-03-06 12:26:15 -080082
83 </div>
84</div>
85
86<div class="layout-content-row">
87 <div class="layout-content-col span-8">
88
89 <img src="{@docRoot}design/media/multipane_show.png">
90
91 </div>
92 <div class="layout-content-col span-5">
93
94<h4>Show/hide</h4>
Peter Ng252d23d2012-08-07 20:19:10 -070095<p>If your screen cannot accommodate the compound view on rotation show the right pane in full screen view on rotation to portrait. Use the Up icon in action bar to show the parent screen.</p>
Roman Nurikb99ae732012-03-06 12:26:15 -080096
97 </div>
98</div>
99
Scott Maind4cc9422012-10-03 18:47:08 -0700100
Scott Maind4cc9422012-10-03 18:47:08 -0700101
102
Roman Nurikb99ae732012-03-06 12:26:15 -0800103<h2 id="checklist">Checklist</h2>
104
105<ul>
106<li>
107<p>Plan in advance on how your app scales to different screen sizes and screen orientations.</p>
108</li>
109<li>
110<p>Identify the most appropriate method for the panels in your compound views to reorganize
111 themselves when screen orientation changes.</p>
112</li>
113<li>
114<p>Look for opportunities to consolidate your views into multi-panel compound views.</p>
115</li>
116<li>
Peter Ng252d23d2012-08-07 20:19:10 -0700117<p>Make sure that your screens try to provide functional parity after the screen orientation
Roman Nurikb99ae732012-03-06 12:26:15 -0800118 changes.</p>
119</li>
120</ul>