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