1page.title=App Structure
2page.tags=navigation,layout,tablet
3@jd:body
4
5
6<a class="notice-designers-material"
7  href="http://www.google.com/design/spec/patterns/app-structure.html">
8  <div>
9    <h3>Material Design</h3>
10    <p>App Structure<p>
11  </div>
12</a>
13
14    <p>Apps come in many varieties that address very different needs. For example:</p>
15<ul>
16<li>Apps such as Calculator or Camera that are built around a single focused activity handled from a
17  single screen</li>
18<li>Apps such as Phone whose main purpose is to switch between different activities without deeper
19  navigation</li>
20<li>Apps such as Gmail or the Play Store that combine a broad set of data views with deep navigation</li>
21</ul>
22<p>Your app's structure depends largely on the content and tasks you want to surface for your users.</p>
23<h2 id="general-structure">General Structure</h2>
24
25<p>A typical Android app consists of top level and detail/edit views. If the navigation hierarchy is
26deep and complex, category views connect top level and detail views.</p>
27
28<div class="cols">
29  <div class="col-9">
30
31    <img src="{@docRoot}design/media/app_structure_overview.png">
32
33  </div>
34  <div class="col-4">
35
36<h4>Top level views</h4>
37<p>The top level of the app typically consists of the different views that your app supports. The views
38either show different representations of the same data or expose an altogether different functional
39facet of your app.</p>
40<div class="vspace size-3">&nbsp;</div>
41
42<h4>Category views</h4>
43<p>Category views allow you to drill deeper into your data.</p>
44<div class="vspace size-11">&nbsp;</div>
45
46<h4>Detail/edit view</h4>
47<p>The detail/edit view is where you consume or create data.</p>
48
49  </div>
50</div>
51
52<h2 id="top-level">Top Level</h2>
53
54<p>The layout of your start screen requires special attention. This is the first screen people see
55after launching your app, so it should be an equally rewarding experience for new and frequent
56visitors alike.</p>
57<p>Ask yourself: "What are my typical users most likely going to want to do in my app?", and structure
58your start screen experience accordingly.</p>
59
60<div class="cols">
61  <div class="col-5">
62
63<h4>Put content forward</h4>
64<p>Many apps focus on the content display. Avoid navigation-only screens and instead let people get to
65the meat of your app right away by making content the centerpiece of your start screen. Choose
66layouts that are visually engaging and appropriate for the data type and screen size.</p>
67
68  </div>
69  <div class="col-8">
70
71    <img src="{@docRoot}design/media/app_structure_market.png">
72    <div class="figure-caption">
73      Play Music allows navigation among artists, albums, and playlists through rich content display.
74      It is also enriched with tailored recommendations and promotions that surface content of interest
75      to the user. Search is readily available from the action bar.
76    </div>
77
78  </div>
79</div>
80
81<h4>Set up action bars for navigation and actions</h4>
82
83<div class="cols">
84  <div class="col-5">
85
86  <p>All screens in your app should display action bars to provide consistent navigation and surface
87important actions.</p>
88    <p>At the top level, special considerations apply to the action bar:</p>
89  <ul>
90    <li>Use the action bar to display your app's icon or title.</li>
91    <li>If your top level consists of multiple views, make sure that it's easy for the user to navigate between them by adding view controls to your action bar.</li>
92    <li>If your app allows people to create content, consider making the content accessible right from the
93  top level.</li>
94        <li>If your content is searchable, include the Search action in the action bar so people can cut
95  through the navigation hierarchy.</li>
96    </ul>
97
98  </div>
99  <div class="col-8">
100
101    <img src="{@docRoot}design/media/app_structure_gmail.png">
102    <div class="figure-caption">
103      A calendar is about productivity, so an efficient, easy-to-skim view with higher data density works
104      well. Navigation supports switching views of day, week, month, and agenda views.
105    </div>
106
107  </div>
108</div>
109
110<h2 id="top-level-switching">Top Level Switching With View Controls</h2>
111<p>The top level communicates your app’s capabilities by introducing the user to the major functional areas. In many cases the top level will consist of multiple views, and you need to make sure that the user can navigate between them efficiently. Android supports a number of view controls for this task. Use the control that best matches your app's navigation needs:</p>
112
113<h4>Fixed tabs</h4>
114<div class="cols">
115  <div class="col-6">
116<p><em>Fixed tabs</em> display top-level views concurrently and make it easy to explore and switch between them. They are always visible on the screen, and can't be moved out of the way like scrollable tabs. <em>Fixed tabs</em> should always allow the user to navigate between the views by swiping left or right on the content area.</p>
117<p><strong>Use tabs if</strong>:</p>
118<ul>
119<li>You expect your app's users to switch views frequently.</li>
120<li>You have a limited number of up to three top-level views.</li>
121<li>You want the user to be highly aware of the alternate views.</li>
122</ul>
123
124  </div>
125  <div class="col-7">
126
127    <img src="{@docRoot}design/media/app_structure_default_tabs.png">
128    <div class="figure-caption">
129      Default fixed tabs shown in Holo Dark &amp; Light.
130    </div>
131
132  </div>
133</div>
134
135<div class="cols">
136  <div class="col-6">
137
138<h4>Spinners</h4>
139<p>A <em>spinner</em> is a drop-down menu that allows users to switch between views of your app. </p>
140<p><strong>Use a spinner in the main action bar if</strong>:</p>
141<ul>
142<li>You don't want to give up the vertical screen real estate for a dedicated tab bar.</li>
143<li>The user is switching between views of the same data set (for example: calendar events viewed by day, week, or month) or data sets of the same type (such as content for two different accounts).</li>
144</ul>
145
146  </div>
147  <div class="col-7">
148
149    <img src="{@docRoot}design/media/app_structure_spinner.png">
150    <div class="figure-caption">
151      Action bar spinner from Calendar application.
152    </div>
153
154  </div>
155</div>
156
157<h4>Navigation drawers</h4>
158<div class="cols">
159  <div class="col-6">
160<p>A <em>navigation drawer</em> is a slide-out menu that allows users to switch between views of your app. It can hold a large number of items and is accessible from anywhere in your app. Navigation drawers show your app's top-level views, but can also provide navigation to lower-level screens. This makes them particularly suitable for complex apps.</p>
161
162<p><strong>Use navigation drawers if</strong>:</p>
163<ul>
164<li>You don't want to give up the vertical screen real estate for a dedicated tab bar.</li>
165<li>You have a large number of top-level views.</li>
166<li>You want to provide direct access to screens on lower levels.</li>
167<li>You want to provide quick navigation to views which don't have direct relationships between each other.</li>
168<li>You have particularly deep navigation branches.</li>
169</ul>
170
171  </div>
172  <div class="col-7">
173    <img src="{@docRoot}design/media/app_structure_drawer.png">
174    <div class="figure-caption">
175      Navigation drawer from the Keep app.
176    </div>
177  </div>
178</div>
179
180<h4>Don't mix and match</h4>
181<p>After choosing the best top-level navigation for your app, don't mix and match patterns. For example, if you decide to use tabs for top-level switching, don't add a drawer, even if your navigation branches are deep. In this case, the navigation drawer would simply duplicate the information on the tabs, confusing your users.</p>
182
183<h2 id="categories">Categories</h2>
184
185<p>Generally, the purpose of a deep, data-driven app is to navigate through organizational categories
186to the detail level, where data can be viewed and managed. Minimize perceived navigation effort by
187keeping your apps shallow.</p>
188<p>Even though the number of vertical navigation steps from the top level down to the detail views is
189typically dictated by the structure of your app's content, there are several ways you can cut down
190on the perception of onerous navigation.</p>
191<h4>Use tabs to combine category selection and data display</h4>
192<p>This can be successful if the categories are familiar or the number of categories is small. It has
193the advantage that a level of hierarchy is removed and data remains at the center of the user's
194attention. Navigating laterally between data-rich categories is more akin to a casual browsing
195experience than to an explicit navigation step.</p>
196
197<div class="vspace size-1">&nbsp;</div>
198
199<div class="cols">
200  <div class="col-8">
201
202<p>If the categories are familiar, predictable, or closely related, use scrolling tabs (where not all
203items are in view simultaneously). Keep the number of scrolling tabs at a manageable level to
204minimize navigational effort. Rule of thumb: no more than 5&ndash;7 tabs.</p>
205
206    <img src="{@docRoot}design/media/app_structure_scrolltabs.png">
207    <div class="figure-caption">
208      The Play Store app uses tabs to simultaneously show category choice and content. To navigate
209      between categories, users can swipe left/right on the content.
210    </div>
211
212  </div>
213  <div class="col-5">
214
215<p>If the categories in the tabs are not closely related, favor fixed tabs, so that all categories are
216in view at the same time.</p>
217
218    <img src="{@docRoot}design/media/app_structure_fixedtabs.png">
219    <div class="figure-caption">
220      People uses fixed tabs to switch between different, relatively unrelated functional areas.
221    </div>
222
223
224  </div>
225</div>
226
227<p>For more discussion, see the <a href="{@docRoot}design/building-blocks/tabs.html">Tabs</a>
228design guide.</p>
229
230
231<h4>Allow cutting through hierarchies</h4>
232<p>Take advantage of shortcuts that allow people to reach their goals quicker. To allow top-level
233invocation of actions for a data item from within list or grid views, display prominent actions
234directly on list view items using drop-downs or split list items. This lets people invoke actions on
235data without having to navigate all the way down the hierarchy.</p>
236
237<img src="{@docRoot}design/media/app_structure_shortcut_on_item.png">
238<div class="figure-caption">
239  Music allows the user to act upon a data item (song) from within the category view (album),
240  thereby removing the need to navigate all the way down to the song's detail view.
241</div>
242
243<h4>Acting upon multiple data items</h4>
244<p>Even though category views mostly serve to guide people to content detail, keep in mind that there
245are often good reasons to act on collections of data as well.</p>
246<p>For example, if you allow people to delete an item in a detail view, you should also allow them to
247delete multiple items in the category view. Analyze which detail view actions are applicable to
248collections of items. Then use multi-select to allow application of those actions to multiple items
249in a category view.</p>
250
251
252<p>For more discussion, see the <a href="{@docRoot}design/patterns/selection.html">Selection</a>
253design guide.</p>
254
255
256<h2 id="details">Details</h2>
257
258<p>The detail view allows you to view and act on your data. The layout of the detail view depends on the data type being displayed, and therefore differs widely among apps.</p>
259
260<div class="cols">
261  <div class="col-4">
262
263<h4>Layout</h4>
264<p>Consider the activities people will perform in the detail view and arrange the layout accordingly.</p>
265
266  </div>
267  <div class="col-9">
268
269    <img src="{@docRoot}design/media/app_structure_people_detail.png">
270
271    <div class="figure-caption">
272      The purpose of the People app's detail view is to surface communication options. The list view
273      allows for efficient scanning and quick access of phone numbers, email addresses and other
274      information items. Split items are used to combine calling and messaging into one compact line
275      item.
276    </div>
277  </div>
278</div>
279
280
281<h4>Make navigation between detail views efficient</h4>
282<p>If your users are likely to want to look at multiple items in sequence, allow them to navigate
283between items from within the detail view. Use swipe views or other techniques, such as thumbnail view controls,
284to achieve this.</p>
285
286<img src="{@docRoot}design/media/app_structure_gmail_swipe.png">
287<div class="figure-caption">
288  Gmail using swipe views to navigate from detail view to detail view.
289</div>
290
291<img src="{@docRoot}design/media/app_structure_gallery_filmstrip.png">
292<div class="figure-caption">
293  In addition to supporting swipe gestures to move left or right through pages, Magazines provides a
294  thumbnail view control that lets people quickly jump to specific pages.
295</div>
296
297<p>For more discussion, see the <a href="{@docRoot}design/patterns/swipe-views.html">Swipe Views</a>
298design guide.</p>
299
300
301<h2 id="checklist">Checklist</h2>
302
303<ul>
304<li>
305<p>Find ways to display useful content on your start screen.</p>
306</li>
307<li>
308<p>Use action bars to provide consistent navigation.</p>
309</li>
310<li>
311<p>Keep your hierarchies shallow by using horizontal navigation and shortcuts.</p>
312</li>
313<li>
314<p>Use multi-select to allow the user to act on collections of data.</p>
315</li>
316<li>
317<p>Allow for quick navigation between detail items with swipe views.</p>
318</li>
319</ul>
320