1 page.title=Tab Icons 2 excludeFromSuggestions=true 3 parent.title=Icon Design Guidelines 4 parent.link=icon_design.html 5 @jd:body 6 7 <div id="qv-wrapper"> 8 <div id="qv"> 9 10 <h2>In this document</h2> 11 12 <ol> 13 <li><a href="#tabstates">Providing Icons for Two Tab States</a> 14 <li><a href="#icon5">Android 2.0 through Android 2.3</a> 15 <ol> 16 <li><a href="#size5">Size</a></li> 17 <li><a href="#style5">Style, colors, and effects</a></li> 18 <li><a href="#dodonts5">Do's and don'ts</a></li> 19 <li><a href="#examples5">Example icons</a></li> 20 </ol> 21 </li> 22 <li><a href="#icon1">Android 1.6 and Earlier</a></li> 23 </ol> 24 25 <h2>See also</h2> 26 27 <ol> 28 <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple 29 Screens</a></li> 30 </ol> 31 32 </div> 33 </div> 34 35 36 <div class="note design"> 37 <p><strong>New Guides for App Designers!</strong></p> 38 <p>Check out the new documents for designers at <strong><a 39 href="{@docRoot}design/index.html">Android Design</a></strong>, including more guidelines 40 for <a href="{@docRoot}design/style/iconography.html">Iconography</a>.</p> 41 </div> 42 43 44 <p>Tab icons are graphical elements used to represent individual tabs in a 45 multi-tab interface. Each tab icon has two states: unselected and selected.</p> 46 47 <p>As described in <a href="icon_design.html#icon-sets">Providing 48 Density-Specific Icon Sets</a>, you should create separate icon sets for low-, 49 medium-, and high-density screens. This ensures that your icons will display 50 properly across the range of devices on which your application can be installed. 51 See <a href="icon_design.html#design-tips">Tips for Designers</a> 52 for suggestions on how to work with multiple sets of icons.</p> 53 54 <p><strong>Final art must be exported as a transparent PNG file. Do not include 55 a background color</strong>.</p> 56 57 <p>Templates for creating icons in Adobe Photoshop are available in the <a 58 href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon 59 Templates Pack</a>.</p> 60 61 62 63 <p class="warning"><strong>Warning:</strong> 64 65 The style of tab icons has changed drastically in 66 Android 2.0 compared to <a href="#icon1">previous versions</a>. <strong>To 67 provide support for all Android versions</strong>, developers should: 68 <br> 69 1. Place tab icons for Android 2.0 and higher in the 70 <code>drawable-hdpi-v5</code>, <code>drawable-mdpi-v5</code>, and <code>drawable-ldpi-v5</code> directories. 71 <br> 72 2. Place tab icons for previous versions in 73 <code>drawable-hdpi</code>, <code>drawable-mdpi</code>, and <code>drawable-ldpi</code> directories. 74 <br> 75 3. Set <code>android:targetSdkVersion</code> to 5 or higher in the 76 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><uses-sdk></a> 77 in the <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">application manifest</a>. 78 This will inform the system that it should render tabs using the new tab style. 79 80 </p> 81 82 83 <h2 id="tabstates">Providing Icons for Two Tab States</h2> 84 85 <p>Tab icons should have two states: unselected and selected. To provide icons 86 with multiple states, developers must create a 87 <a href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">state 88 list drawable</a> for each an icon, which is an XML file that lists which image 89 to use for the different UI states.</p> 90 91 <p>For example, for a tab widget with tabs named 'Friends' and 'Coworkers', 92 you can use a directory structure similar to the one below:</p> 93 94 <pre>res/... 95 drawable/... 96 <strong>ic_tab_friends.xml</strong> 97 <strong>ic_tab_coworkers.xml</strong> 98 drawable-ldpi/... 99 ic_tab_friends_selected.png 100 ic_tab_friends_unselected.png 101 ic_tab_coworkers_selected.png 102 ic_tab_coworkers_unselected.png 103 drawable-mdpi/... 104 ic_tab_friends_selected.png 105 ic_tab_friends_unselected.png 106 ic_tab_coworkers_selected.png 107 ic_tab_coworkers_unselected.png 108 drawable-hdpi/... 109 ... 110 drawable-ldpi-v5/... 111 ... 112 drawable-mdpi-v5/... 113 ... 114 drawable-hdpi-v5/... 115 ...</pre> 116 117 <p>The contents of the XML files listed above should reference the corresponding 118 selected and unselected icon drawables. For example, below is the code 119 for <code>ic_tab_friends.xml</code>:</p> 120 121 <pre> 122 <?xml version="1.0" encoding="utf-8"?> 123 <selector xmlns:android="http://schemas.android.com/apk/res/android"> 124 <!-- selected state --> 125 <item android:drawable="@drawable/ic_tab_friends_selected" 126 android:state_selected="true" 127 android:state_pressed="false" /> 128 <!-- unselected state (default) --> 129 <item android:drawable="@drawable/ic_tab_friends_unselected" /> 130 </selector> 131 </pre> 132 133 134 135 136 <h2 id="icon5">Android 2.0 through Android 2.3</h2> 137 138 <p>The following guidelines describe how to design tab icons for Android 139 2.0 through Android 2.3 (API Levels 5 through 10).</p> 140 141 <h3 id="size5">Size and positioning</h3> 142 143 <p>Tab icons should use simple shapes and forms and those must be 144 scaled and positioned inside the final asset.</p> 145 146 <p>Figure 1 illustrates various ways of positioning the icon inside the 147 asset. You should size the icons <em>smaller than the actual bounds of the 148 asset</em>.</p> 149 150 <p>In order to indicate the recommended size for the icon, each example in 151 Figure 1 includes three different guide rectangles:</p> 152 153 <ul> 154 <li>The red box is the bounding box for the full asset.</li> 155 <li>The blue box is the recommended bounding box for the actual icon. 156 The icon box is sized smaller than the full asset box to allow for 157 special icon treatments.</li> 158 <li>The orange box is the recommended bounding box for the actual icon when 159 the content is square. The box for square icons is smaller than that for other 160 icons to establish a consistent visual weight across the two types.</li> 161 </ul> 162 163 164 <table> 165 <tr> 166 167 <td style="border:0;"> 168 <ol class="nolist"> 169 <li>Tab icon dimensions for high-density (<code>hdpi</code>) screens:</li> 170 <ol class="nolist"> 171 <li>Full Asset: 48 x 48 px</li> 172 <li>Icon: 42 x 42 px</li> 173 </ol> 174 </li> 175 </ol> 176 </td> 177 <td style="border:0;"> 178 <img src="{@docRoot}images/icon_design/tab_size_hdpi.png" width="385"> 179 </td> 180 </tr> 181 <tr> 182 <td style="border:0;"> 183 <ol class="nolist"> 184 <li>Tab icon dimensions for medium-density (<code>mdpi</code>) screens:</li> 185 <ol class="nolist"> 186 <li>Full Asset: 32 x 32 px</li> 187 <li>Icon: 28 x 28 px</li> 188 </ol> 189 </li> 190 </ol> 191 </td> 192 193 <td style="border:0;"> 194 <img src="{@docRoot}images/icon_design/tab_size_mdpi.png" width="385"> 195 </td> 196 </tr> 197 <tr> 198 <td style="border:0;"> 199 <ol class="nolist"> 200 <li>Tab icon dimensions for low-density (<code>ldpi</code>) screens:</li> 201 <ol class="nolist"> 202 <li>Full Asset: 24 x 24 px</li> 203 <li>Icon: 22 x 22 px</li> 204 </ol> 205 </li> 206 </ol> 207 </td> 208 209 <td style="border:0;"> 210 <img src="{@docRoot}images/icon_design/tab_size_ldpi.png" width="385"> 211 </td> 212 </tr> 213 214 <tr> 215 <td style="border:0;"></td> 216 <td style="border:0;"> 217 <p class="table-caption"><strong>Figure 1.</strong> 218 Tab icon sizing and positioning inside the bounds of the 219 icon asset.</p> 220 </td> 221 </tr> 222 223 </table> 224 225 226 227 228 <h3 id="style5">Style, colors, and effects</h3> 229 230 <p>Tab icons are flat, matte, and pictured face-on.</p> 231 232 <p>Tab icons should have two states: selected and unselected.</p> 233 234 <table class="image-caption"> 235 <tr> 236 <td class="image-caption-i"> 237 <img src="{@docRoot}images/icon_design/tab_style_unselected.png" alt="A view of effects for unselected tab icons."/> 238 </td> 239 <td class="image-caption-c"> 240 <div class="caption grad-rule-top"> 241 <p><strong>Figure 2. </strong>Style and effects for unselected tab icons.</p> 242 <div class="image-caption-nested"> 243 <p><em>Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.</em></p> 244 <table> 245 <tr><td><em>1.</em></td><td nowrap>Fill color:</td><td><code>#808080</code><br><br></td></tr> 246 <tr><td><em>2.</em></td><td nowrap>Inner content:</td><td>Inner content should subtract from the outer shape and consist purely of transparent pixels.</td></tr> 247 </table> 248 </div> 249 </div> 250 </td> 251 </tr> 252 </table> 253 254 <table class="image-caption"> 255 <tr> 256 <td class="image-caption-i"> 257 <img src="{@docRoot}images/icon_design/tab_style_selected.png" alt="A view of effects for selected tab icons."/> 258 </td> 259 <td class="image-caption-c"> 260 <div class="caption grad-rule-top"> 261 <p><strong>Figure 3. </strong>Style and effects for selected tab icons.</p> 262 <div class="image-caption-nested"> 263 <p><em>Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.</em></p> 264 <table> 265 <tr><td><em>1.</em></td><td nowrap>Fill color:</td><td><code>#FFFFFF</code><br><br></td></tr> 266 <tr><td><em>2.</em></td><td nowrap>Inner content:</td><td>Inner content should subtract from the outer shape and consist purely of transparent pixels.<br><br></td></tr> 267 <tr><td><em>3.</em></td><td nowrap>Outer glow:</td><td><code>#000000</code>, 25% opacity<br>size 3px</td></tr> 268 </table> 269 </div> 270 </div> 271 </td> 272 </tr> 273 </table> 274 275 276 277 <h3 id="dosdonts5">Do's and don'ts</h3> 278 279 <p>Below are some "do and don't" examples to consider when creating tab icons for 280 your application. </p> 281 282 283 <img src="{@docRoot}images/icon_design/do_dont_tabicons.png"> 284 285 286 287 288 <h3 id="examples5">Example icons</h3> 289 290 <p>Shown below are standard high-density tab icons that are used in 291 the Android platform.</p> 292 293 <p class="warning"><strong>Warning:</strong> 294 Because these resources can change between platform versions, you 295 should not reference the system's copy of the resources. If you want to 296 use any icons or other internal drawable resources, you should store a 297 local copy of those icons or drawables in your application resources, 298 then reference the local copy from your application code. In that way, you can 299 maintain control over the appearance of your icons, even if the system's 300 copy changes. Note that the grid below is not intended to be complete.</p> 301 302 <img src="{@docRoot}images/icon_design/tab_standard.png" /> 303 304 305 306 <h2 id="icon1">Android 1.6 and Earlier</h2> 307 308 <p>The following guidelines describe how to design tab icons for Android 309 1.6 (API Level 4) and earlier.</p> 310 311 <h4 id="structure1">Structure</h4> 312 313 <ul> 314 <li>Unselected tab icons have the same fill gradient and effects as 315 <a href="icon_design_menu.html#icon1">menu icons</a>, 316 but with no outer glow.</li> 317 318 <li>Selected tab icons look just like unselected tab icons, but with a fainter 319 inner shadow, and have the same front part gradient as 320 <a href="icon_design_dialog.html#icon1">dialog icons</a>.</li> 321 322 <li>Tab icons have a 1 px safeframe which should only be overlapped for the edge 323 of the anti-alias of a round shape.</li> 324 325 <li>All dimensions specified on this page are based on a 32x32 px artboard size. 326 Keep 1 px of padding around the bounding box inside the Photoshop template.</li> 327 328 </ul> 329 330 <table class="image-caption"> 331 <tr> 332 <td class="image-caption-i"> 333 <img src="{@docRoot}images/icon_design/tab_icon_unselected.png" alt="A view of 334 unselected tab icon structure." /> 335 </td> 336 <td class="image-caption-c"> 337 <div class="caption grad-rule-top"> 338 <p><strong>Figure 3. </strong>Safeframe and fill gradient for unselected tab 339 icons. Icon size is 32x32.</p> 340 </div> 341 </td> 342 </tr> 343 <tr> 344 <td class="image-caption-i"> 345 <img src="{@docRoot}images/icon_design/tab_icon_selected.png" alt="A view of 346 selected tab icon structure." /> 347 </td> 348 <td class="image-caption-c"> 349 <div class="caption grad-rule-top"> 350 <p><strong>Figure 4. </strong>Safeframe and fill gradient for tab icons in 351 selected state. Icon size is 32x32.</p> 352 </div> 353 </td> 354 </tr> 355 </table> 356 357 <h3 id="unselectedtabdetails1">Unselected tab icon</h3> 358 359 <h4 id="unselectedtablight1">Light, effects, and shadows</h4> 360 361 <p>Unselected tab icons look just like the selected tab icons, but with a 362 fainter inner shadow, and the same front part gradient as the dialog icons.</p> 363 364 <table class="image-caption"> 365 <tr> 366 <td class="image-caption-i"> 367 <img src="{@docRoot}images/icon_design/tab_unselected_light.png" alt="A view 368 of light, effects, and shadows for unselected tab icons."/> 369 </td> 370 <td class="image-caption-c"> 371 <div class="caption grad-rule-top"> 372 <p><strong>Figure 5. </strong>Light, effects, and shadows for unselected 373 tab icons.</p> 374 <div class="image-caption-nested"> 375 <table> 376 <tr><td><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90<br>bottom color: r 223 | g 223 | b 223<br>top color: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr> 377 <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 10 % opacity | angle 90 distance 2px | size 2px</td></tr> 378 <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90 | altitude 10<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr> 379 </table> 380 </div> 381 </div> 382 </td> 383 </tr> 384 </table> 385 386 387 <table> 388 <tr> 389 <td style="border:0"> 390 391 <h4 id="unselectedtabsteps1">Step by step</h4> 392 393 <ol> 394 <li>Create the basic shapes using a tool like Adobe Illustrator.</li> 395 <li>Import the shape to a tool like Adobe Photoshop and scale to fit an image of 396 32x32 px on a transparent background.</li> 397 <li>Add the effects seen in Figure 5 for the unselected state filter.</li> 398 <li>Export the icon at 32x32 as a PNG file with transparency enabled.</li> 399 </ol> 400 401 </td> 402 </tr> 403 </table> 404 405 <h3 id="selectedtabdetails1">Selected tab icon</h3> 406 407 <p>The selected tab icons have the same fill gradient and effects as the menu 408 icon, but with no outer glow.</p> 409 410 <table class="image-caption"> 411 <tr> 412 <td class="image-caption-i"> 413 <img src="{@docRoot}images/icon_design/tab_selected_light.png" alt="A view of 414 light, effects, and shadows for selected tab icons."/> 415 </td> 416 <td class="image-caption-c"> 417 <div class="caption grad-rule-top"> 418 <p><strong>Figure 6. </strong>Light, effects, and shadows for selected tab 419 icons.</p> 420 <div class="image-caption-nested"> 421 <table> 422 <tr><td><em>1.</em></td><td>Front part:</td><td>Use fill gradient from color palette.</td></tr> 423 <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20% opacity | <br>angle 90 | distance 2px | <br>size 2px</td></tr> 424 <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90 | <br>altitude 10<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr> 425 </table> 426 </div> 427 </div> 428 </td> 429 </tr> 430 </table> 431 432 <table> 433 <tr> 434 <td style="border:0"> 435 436 <h4 id="selectedtabpalette1">Color palette</h4> 437 438 <table> 439 <tr> 440 <td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png"/></td> 441 <td class="image-caption-c">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill on unselected tab icons.</td> 442 </tr> 443 444 </table> 445 446 </td> 447 448 <td style="border:0"> 449 450 <h4 id="selectedtabsteps1">Step by step</h4> 451 452 <ol> 453 <li>Create the basic shape using a tool like Adobe Illustrator.</li> 454 <li>Import the shape into a tool like Adobe Photoshop and scale to fit a 32x32 455 px artboard with a transparent background. </li> 456 <li>Add the effects seen in Figure 6 for the selected state filter.</li> 457 <li>Export the icon at 32x32 as a PNG file with transparency enabled.</li> 458 </ol> 459 460 </td> 461 </tr> 462 </table> 463