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