1 page.title= 2 parent.title= 3 parent.link=index.html 4 @jd:body 5 6 <div id="qv-wrapper"> 7 <div id="qv"> 8 <h2></h2> 9 <ul> 10 <li> {@code res/} </li> 11 <li></li> 12 <li> 13 </li> 14 </ul> 15 <h2></h2> 16 <ol> 17 <li><a href="#ResourceTypes"></a></li> 18 <li><a href="#AlternativeResources"></a> 19 <ol> 20 <li><a href="#QualifierRules"></a></li> 21 <li><a href="#AliasResources"></a></li> 22 </ol> 23 </li> 24 <li><a href="#Compatibility"></a></li> 25 <li><a href="#BestMatch">Android </a></li> 26 </ol> 27 28 <h2></h2> 29 <ol> 30 <li><a href="accessing-resources.html"></a></li> 31 <li><a href="available-resources.html"></a></li> 32 <li><a href="{@docRoot}guide/practices/screens_support.html"></a> 33 </li> 34 </ol> 35 </div> 36 </div> 37 38 <p> 39 40 Android 41 UI 42 43 </p> 44 45 <p> {@code R} ID 46 <a href="accessing-resources.html"></a> 47 48 Android 49 </p> 50 51 52 <h2 id="ResourceTypes"></h2> 53 54 <p> 55 {@code res/} </p> 56 57 <pre class="classic no-pretty-print"> 58 MyProject/ 59 src/ <span style="color:black"> 60 MyActivity.java </span> 61 res/ 62 drawable/ <span style="color:black"> 63 graphic.png </span> 64 layout/ <span style="color:black"> 65 main.xml 66 info.xml</span> 67 mipmap/ <span style="color:black"> 68 icon.png </span> 69 values/ <span style="color:black"> 70 strings.xml </span> 71 </pre> 72 73 <p>{@code res/} () {@code mipmap/} 74 75 1 76 </p> 77 78 <p class="note"><strong></strong> mipmap <a href="{@docRoot}tools/projects/index.html#mipmap"></a> 79 </p> 80 81 <p class="table-caption" id="table1"><strong> 1.</strong> {@code res/} 82 </p> 83 84 <table> 85 <tr> 86 <th scope="col"></th> 87 <th scope="col"></th> 88 </tr> 89 90 <tr> 91 <td><code>animator/</code></td> 92 <td><a href="{@docRoot}guide/topics/graphics/prop-animation.html"></a> XML 93 </td> 94 </tr> 95 96 <tr> 97 <td><code>anim/</code></td> 98 <td> <a href="{@docRoot}guide/topics/graphics/view-animation.html#tween-animation">tween </a> XML 99 ({@code animator/} ) 100 101 </td> 102 </tr> 103 104 <tr> 105 <td><code>color/</code></td> 106 <td> XML <a href="color-list-resource.html"></a> 107 </td> 108 </tr> 109 110 <tr> 111 <td><code>drawable/</code></td> 112 113 <td><p> ({@code .png}{@code .9.png}{@code .jpg}{@code .gif}) XML 114 </p> 115 <ul> 116 <li></li> 117 <li> ()</li> 118 <li></li> 119 <li></li> 120 <li></li> 121 <li></li> 122 </ul> 123 <p><a href="drawable-resource.html"></a></p> 124 </td> 125 </tr> 126 127 <tr> 128 <td><code>mipmap/</code></td> 129 <td> {@code mipmap/} <a href="{@docRoot}tools/project/index.html#mipmap"></a> 130 131 </td> 132 </tr> 133 134 <tr> 135 <td><code>layout/</code></td> 136 <td> XML 137 <a href="layout-resource.html"></a></td> 138 </tr> 139 140 <tr> 141 <td><code>menu/</code></td> 142 <td> () XML 143 <a href="menu-resource.html"></a></td> 144 </tr> 145 146 <tr> 147 <td><code>raw/</code></td> 148 <td><p> 149 {@link java.io.InputStream} ID {@link android.content.res.Resources#openRawResource(int) 150 Resources.openRawResource()} ID {@code R.raw.<em>filename</em>}</p> 151 <p> {@code 152 assets/} ( {@code res/raw/}) 153 {@code assets/} ID {@link android.content.res.AssetManager} 154 </p></td> 155 </tr> 156 157 <tr> 158 <td><code>values/</code></td> 159 <td><p> () XML </p> 160 <p> {@code res/} XML XML {@code values/} 161 {@code <resources>} 162 163 {@code <string>} 164 {@code R.string} {@code <color>} {@code R.color} 165 </p> 166 <p> XML 167 168 169 </p> 170 <ul> 171 <li>arrays.xml (<a href="more-resources.html#TypedArray"></a>)</li> 172 <li>colors.xml <a href="more-resources.html#Color"></a></li> 173 <li>dimens.xml <a href="more-resources.html#Dimension"></a></li> 174 <li>strings.xml <a href="string-resource.html"></a> 175 </li> 176 <li>styles.xml <a href="style-resource.html"></a></li> 177 </ul> 178 <p><a href="string-resource.html"></a> 179 <a href="style-resource.html"></a> 180 <a href="more-resources.html"></a></p> 181 </td> 182 </tr> 183 184 <tr> 185 <td><code>xml/</code></td> 186 <td> XML {@link 187 android.content.res.Resources#getXml(int) Resources.getXML()} XML <a href="{@docRoot}guide/topics/search/searchable-config.html"></a> 188 189 <!-- or preferences configuration. --></td> 190 </tr> 191 </table> 192 193 <p class="caution"><strong></strong> 194 {@code res/} — </p> 195 196 <p><a href="available-resources.html"></a></p> 197 198 <p> 1 199 200 Android 201 202 203 204 205 206 </p> 207 208 209 <h2 id="AlternativeResources"></h2> 210 211 212 <div class="figure" style="width:429px"> 213 <img src="{@docRoot}images/resources/resource_devices_diagram2.png" height="167" alt="" /> 214 <p class="img-caption"> 215 <strong> 1.</strong></p> 216 </div> 217 218 <p> 219 220 Android 221 222 </p> 223 224 <p></p> 225 <ol> 226 <li> {@code res/} {@code 227 <em><resources_name></em>-<em><config_qualifier></em>} 228 <ul> 229 <li><em>{@code <resources_name>}</em> ( 1) 230 </li> 231 <li><em>{@code <qualifier>}</em> ( 2) 232 </li> 233 </ul> 234 <p> <em>{@code <qualifier>}</em> 235 </p> 236 <p class="caution"><strong></strong> 2 237 238 </p> 239 </li> 240 <li> 241 </li> 242 </ol> 243 244 <p></p> 245 246 <pre class="classic no-pretty-print"> 247 res/ 248 drawable/ <span style="color:black"> 249 icon.png 250 background.png </span> 251 drawable-hdpi/ <span style="color:black"> 252 icon.png 253 background.png </span> 254 </pre> 255 256 <p>{@code hdpi} 257 258 259 {@code icon.png} {@code 260 background.png} ID Android 261 262 </p> 263 264 <p>Android 265 2 — 266 267 268 </p> 269 270 271 <p class="table-caption" id="table2"><strong> 2.</strong> 272 </p> 273 <table> 274 <tr> 275 <th></th> 276 <th></th> 277 <th></th> 278 </tr> 279 <tr id="MccQualifier"> 280 <td>MCC MNC</td> 281 <td><br/> 282 <code>mcc310</code><br/> 283 <code><nobr>mcc310-mnc004</nobr></code><br/> 284 <code>mcc208-mnc00</code><br/> 285 286 </td> 287 <td> 288 <p>/ (MCC) SIM (MNC) 289 <code>mcc310</code> 290 <code>mcc310-mnc004</code> Verizon <code>mcc208-mnc00</code> Orange 291 </p> 292 <p> (GSM )MCC MNC SIM 293 </p> 294 <p> MCC () 295 <em></em> () 296 MCC MNC 297 </p> 298 <p> {@link 299 android.content.res.Configuration#mcc} {@link 300 android.content.res.Configuration#mnc} 301 </p> 302 </td> 303 </tr> 304 <tr id="LocaleQualifier"> 305 <td></td> 306 <td><br/> 307 <code>en</code><br/> 308 <code>fr</code><br/> 309 <code>en-rUS</code><br/> 310 <code>fr-rFR</code><br/> 311 <code>fr-rCA</code><br/> 312 313 </td> 314 <td><p> <a href="http://www.loc.gov/standards/iso639-2/php/code_list.php">ISO 639-1</a> <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1-alpha-2</a> ( "{@code r}") 315 316 317 318 </p><p> 319 <em></em>{@code r} 320 321 </p> 322 <p> 323 <a href="runtime-changes.html"></a> 324 </p> 325 <p><a href="localization.html"></a> 326 </p> 327 <p> {@link android.content.res.Configuration#locale} 328 </p> 329 </td> 330 </tr> 331 <tr id="LayoutDirectionQualifier"> 332 <td></td> 333 <td><code>ldrtl</code><br/> 334 <code>ldltr</code><br/> 335 </td> 336 <td><p>{@code ldrtl} 337 {@code ldltr} 338 </p> 339 <p> 340 </p> 341 <p> () 342 343 </p> 344 <pre class="classic no-pretty-print"> 345 res/ 346 layout/ <span style="color:black"> 347 main.xml </span>(Default layout) 348 layout-ar/ <span style="color:black"> 349 main.xml </span>(Specific layout for Arabic) 350 layout-ldrtl/ <span style="color:black"> 351 main.xml </span>(Any "right-to-left" language, except 352 for Arabic, because the "ar" language qualifier 353 has a higher precedence.) 354 </pre> 355 <p class="note"><strong></strong> <a href="{@docRoot}guide/topics/manifest/application-element.html#supportsrtl">{@code 356 supportsRtl}</a> {@code "true"} <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> 17 357 </p> 358 <p> API 17<em></em></p> 359 </td> 360 </tr> 361 <tr id="SmallestScreenWidthQualifier"> 362 <td>smallestWidth</td> 363 <td><code>sw<N>dp</code><br/><br/> 364 <br/> 365 <code>sw320dp</code><br/> 366 <code>sw600dp</code><br/> 367 <code>sw720dp</code><br/> 368 369 </td> 370 <td> 371 <p> 372 smallestWidth () 373 {@code <N>} dps UI 374 375 </p> 376 <p> 600 dp {@code 377 res/layout-sw600dp/} 378 600dp 600dp 379 380 smallestWidth <strong> smallestWidth </strong> 381 </p> 382 <p> smallestWidth UI UI smallestWidth smallestWidth UI 383 384 385 <em></em> () 386 387 </p> 388 <p></p> 389 <ul> 390 <li>320 391 <ul> 392 <li>240x320 ldpi (QVGA )</li> 393 <li>320x480 mdpi ()</li> 394 <li>480x800 hdpi ()</li> 395 </ul> 396 </li> 397 <li>480 480x800 mdpi (/)</li> 398 <li>600 600x1024 mdpi (7" )</li> 399 <li>720 720x1280 mdpi (10" )</li> 400 </ul> 401 <p> smallestWidth () smallestWidth 402 403 </p> 404 <p> API 13<em></em></p> 405 <p> <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html#requiresSmallest">{@code 406 android:requiresSmallestWidthDp}</a> smallestWidth {@link 407 android.content.res.Configuration#smallestScreenWidthDp} smallestWidth 408 409 </p> 410 <p><a href="{@docRoot}guide/practices/screens_support.html"></a> 411 412 </p> 413 </td> 414 </tr> 415 <tr id="ScreenWidthQualifier"> 416 <td></td> 417 <td><code>w<N>dp</code><br/><br/> 418 <br/> 419 <code>w720dp</code><br/> 420 <code>w1024dp</code><br/> 421 422 </td> 423 <td> 424 <p> {@code dp} — <code><N></code> 425 426 427 </p> 428 <p> () 429 430 UI UI 431 432 433 434 </p> 435 <p> API 13<em></em></p> 436 <p> {@link android.content.res.Configuration#screenWidthDp} 437 </p> 438 <p><a href="{@docRoot}guide/practices/screens_support.html"></a> 439 440 </p> 441 </td> 442 </tr> 443 <tr id="ScreenHeightQualifier"> 444 <td></td> 445 <td><code>h<N>dp</code><br/><br/> 446 <br/> 447 <code>h720dp</code><br/> 448 <code>h1024dp</code><br/> 449 450 </td> 451 <td> 452 <p>dp — <code><N></code> 453 454 455 </p> 456 <p> () 457 458 UI UI 459 460 461 462 () <em></em> 463 464 465 466 467 <p> API 13<em></em></p> 468 <p> {@link android.content.res.Configuration#screenHeightDp} 469 </p> 470 <p><a href="{@docRoot}guide/practices/screens_support.html"></a> 471 472 </p> 473 </td> 474 </tr> 475 <tr id="ScreenSizeQualifier"> 476 <td></td> 477 <td> 478 <code>small</code><br/> 479 <code>normal</code><br/> 480 <code>large</code><br/> 481 <code>xlarge</code> 482 </td> 483 <td> 484 <ul class="nolist"> 485 <li>{@code small} QVGA 486 320x426 dp 487 QVGA VGA 488 </li> 489 <li>{@code normal} HVGA 490 320x470 dp 491 WQVGA HVGA WVGA 492 493 </li> 494 <li>{@code large} VGA 495 496 480x640 dp 497 VGA WVGA </li> 498 <li>{@code xlarge} HVGA 499 720x960 dp 500 501 502 API 9<em></em></li> 503 </ul> 504 <p class="note"><strong></strong><em></em> 505 <a href="#BestMatch"></a> 506 507 </p> 508 <p class="caution"><strong></strong><em></em><strong></strong> ( {@code 509 xlarge} ) 510 511 </p> 512 <p> API 4<em></em></p> 513 514 <p><a href="{@docRoot}guide/practices/screens_support.html"></a> 515 </p> 516 <p> {@link android.content.res.Configuration#screenLayout} 517 518 </p> 519 </td> 520 </tr> 521 <tr id="ScreenAspectQualifier"> 522 <td></td> 523 <td> 524 <code>long</code><br/> 525 <code>notlong</code> 526 </td> 527 <td> 528 <ul class="nolist"> 529 <li>{@code long} WQVGAWVGAFWVGA</li> 530 <li>{@code notlong} QVGAHVGAVGA</li> 531 </ul> 532 <p> API 4<em></em></p> 533 <p> () 534 </p> 535 <p> {@link android.content.res.Configuration#screenLayout} 536 </p> 537 </td> 538 </tr> 539 <tr id="OrientationQualifier"> 540 <td></td> 541 <td> 542 <code>port</code><br/> 543 <code>land</code> <!-- <br/> 544 <code>square</code> --> 545 </td> 546 <td> 547 <ul class="nolist"> 548 <li>{@code port} ()</li> 549 <li>{@code land} ()</li> 550 <!-- Square mode is currently not used. --> 551 </ul> 552 <p> 553 <a href="runtime-changes.html"></a> 554 </p> 555 <p> {@link android.content.res.Configuration#orientation} 556 </p> 557 </td> 558 </tr> 559 <tr id="UiModeQualifier"> 560 <td>UI </td> 561 <td> 562 <code>car</code><br/> 563 <code>desk</code><br/> 564 <code>television</code><br/> 565 <code>appliance</code> 566 <code>watch</code> 567 </td> 568 <td> 569 <ul class="nolist"> 570 <li>{@code car}</li> 571 <li>{@code desk}</li> 572 <li>{@code television} UI DPAD 573 574 575 </li> 576 <li>{@code appliance} 577 </li> 578 <li>{@code watch}</li> 579 </ul> 580 <p> API 8 API 13 API 20<em></em></p> 581 <p><a href="{@docRoot}training/monitoring-device-state/docking-monitoring.html"></a> 582 583 </p> 584 <p> 585 {@link 586 android.app.UiModeManager} <a href="runtime-changes.html"></a> 587 </p> 588 </td> 589 </tr> 590 <tr id="NightQualifier"> 591 <td></td> 592 <td> 593 <code>night</code><br/> 594 <code>notnight</code> 595 </td> 596 <td> 597 <ul class="nolist"> 598 <li>{@code night}</li> 599 <li>{@code notnight}</li> 600 </ul> 601 <p> API 8<em></em></p> 602 <p> () 603 {@link android.app.UiModeManager} 604 <a href="runtime-changes.html"></a> 605 </p> 606 </td> 607 </tr> 608 <tr id="DensityQualifier"> 609 <td> (dpi)</td> 610 <td> 611 <code>ldpi</code><br/> 612 <code>mdpi</code><br/> 613 <code>hdpi</code><br/> 614 <code>xhdpi</code><br/> 615 <code>xxhdpi</code><br/> 616 <code>xxxhdpi</code><br/> 617 <code>nodpi</code><br/> 618 <code>tvdpi</code> 619 </td> 620 <td> 621 <ul class="nolist"> 622 <li>{@code ldpi} 120dpi</li> 623 <li>{@code mdpi} ( HVGA) 160dpi 624 </li> 625 <li>{@code hdpi} 240dpi</li> 626 <li>{@code xhdpi} 320dpi API 8 627 <em></em></li> 628 <li>{@code xxhdpi} 480dpi API 16 629 <em></em></li> 630 <li>{@code xxxhdpi} (<a href="{@docRoot}guide/practices/screens_support.html#xxxhdpi-note"></a><em></em>) 640dpi 631 632 API 18 633 <em></em></li> 634 <li>{@code nodpi} 635 </li> 636 <li>{@code tvdpi} mdpi hdpi 213dpi 637 —mdpi hdpi 638 639 API 13 </li> 640 </ul> 641 <p> 3:4:6:8:12:16 (tvdpi ) 642 ldpi 9x9 mdpi 12x12 hdpi 18x18 xhdpi 24x24 643 </p> 644 <p> tvdpi 1.33*mdpi 645 mdpi 100px x 100px tvdpi 133px x 133px 646 </p> 647 <p class="note"><strong></strong> 648 <em></em><a href="#BestMatch"></a> 649 650 </p> 651 <p><a href="{@docRoot}guide/practices/screens_support.html"></a> Android 652 653 </p> 654 </td> 655 </tr> 656 <tr id="TouchscreenQualifier"> 657 <td></td> 658 <td> 659 <code>notouch</code><br/> 660 <code>finger</code> 661 </td> 662 <td> 663 <ul class="nolist"> 664 <li>{@code notouch}</li> 665 <li>{@code finger} 666 </li> 667 </ul> 668 <p> {@link android.content.res.Configuration#touchscreen} 669 </p> 670 </td> 671 </tr> 672 <tr id="KeyboardAvailQualifier"> 673 <td></td> 674 <td> 675 <code>keysexposed</code><br/> 676 <code>keyshidden</code><br/> 677 <code>keyssoft</code> 678 </td> 679 <td> 680 <ul class="nolist"> 681 <li>{@code keysexposed} () 682 683 <em></em> 684 685 </li> 686 <li>{@code keyshidden} 687 <em></em><em></em></li> 688 <li>{@code keyssoft} 689 </li> 690 </ul> 691 <p> <code>keysexposed</code> <code>keyssoft</code> <code>keysexposed</code> 692 693 </p> 694 <p> 695 <a href="runtime-changes.html"></a> 696 </p> 697 <p> {@link 698 android.content.res.Configuration#hardKeyboardHidden} {@link 699 android.content.res.Configuration#keyboardHidden} () 700 </p> 701 </td> 702 </tr> 703 <tr id="ImeQualifier"> 704 <td></td> 705 <td> 706 <code>nokeys</code><br/> 707 <code>qwerty</code><br/> 708 <code>12key</code> 709 </td> 710 <td> 711 <ul class="nolist"> 712 <li>{@code nokeys}</li> 713 <li>{@code qwerty} qwerty 714 715 </li> 716 <li>{@code 12key} 12 717 </li> 718 </ul> 719 <p> {@link android.content.res.Configuration#keyboard} 720 </p> 721 </td> 722 </tr> 723 <tr id="NavAvailQualifier"> 724 <td></td> 725 <td> 726 <code>navexposed</code><br/> 727 <code>navhidden</code> 728 </td> 729 <td> 730 <ul class="nolist"> 731 <li>{@code navexposed}</li> 732 <li>{@code navhidden} () 733 </li> 734 </ul> 735 <p> 736 <a href="runtime-changes.html"></a> 737 </p> 738 <p> {@link android.content.res.Configuration#navigationHidden} 739 </p> 740 </td> 741 </tr> 742 <tr id="NavigationQualifier"> 743 <td></td> 744 <td> 745 <code>nonav</code><br/> 746 <code>dpad</code><br/> 747 <code>trackball</code><br/> 748 <code>wheel</code> 749 </td> 750 <td> 751 <ul class="nolist"> 752 <li>{@code nonav} 753 </li> 754 <li>{@code dpad} (d-pad)</li> 755 <li>{@code trackball}</li> 756 <li>{@code wheel} ()</li> 757 </ul> 758 <p> {@link android.content.res.Configuration#navigation} 759 </p> 760 </td> 761 </tr> 762 <!-- DEPRECATED 763 <tr> 764 <td>Screen dimensions</td> 765 <td>Examples:<br/> 766 <code>320x240</code><br/> 767 <code>640x480</code><br/> 768 etc. 769 </td> 770 <td> 771 <p>The larger dimension must be specified first. <strong>This configuration is deprecated 772 and should not be used</strong>. Instead use "screen size," "wider/taller screens," and "screen 773 orientation" described above.</p> 774 </td> 775 </tr> 776 --> 777 <tr id="VersionQualifier"> 778 <td> (API )</td> 779 <td><br/> 780 <code>v3</code><br/> 781 <code>v4</code><br/> 782 <code>v7</code><br/> 783 </td> 784 <td> 785 <p> API <code>v1</code> API 1 ( Android 1.0 ) <code>v4</code> API 4 ( Android1.6 ) 786 787 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">Android API </a> 788 </p> 789 </td> 790 </tr> 791 </table> 792 793 794 <p class="note"><strong></strong> Android1.0 Android 795 796 797 <code>w600dp</code> <code>v13</code> API 13 798 (<em></em>) 799 <a href="#Compatibility"></a> 800 801 </p> 802 803 804 805 <h3 id="QualifierRules"></h3> 806 807 <p></p> 808 809 <ul> 810 <li> 811 <code>drawable-en-rUS-land</code> 812 </li> 813 <li><a href="#table2"> 2</a> 814 815 <ul> 816 <li><code>drawable-hdpi-port/</code></li> 817 <li><code>drawable-port-hdpi/</code></li> 818 </ul> 819 </li> 820 <li> 821 <code>res/drawable/drawable-en/</code></li> 822 <li> 823 824 </li> 825 <li> <em></em> 826 <code>drawable-rES-rFR/</code> 827 828 <code>drawable-rES/</code> <code>drawable-rFR/</code> 829 830 831 <a href="#AliasResources"></a></li> 832 </ul> 833 834 <p>Android 835 836 Android <a href="#BestMatch"> 837 </a> () 838 Android () 839 840 841 </p> 842 843 844 845 <h3 id="AliasResources"></h3> 846 847 <p> () 848 849 () 850 851 </p> 852 853 <p class="note"><strong></strong> 854 {@code xml/} 855 </p> 856 857 <p> {@code icon.png} 858 859 860 861 {@code icon_ca.png} ({@code icon.png} ) {@code res/drawable/} 862 863 {@code 864 res/drawable-en-rCA/} {@code icon.xml} {@code res/drawable-fr-rCA/} {@code <bitmap>} {@code icon_ca.png} 865 PNG XML 866 ( XML )</p> 867 868 869 <h4></h4> 870 871 <p> {@code <bitmap>} 872 </p> 873 874 <pre> 875 <?xml version="1.0" encoding="utf-8"?> 876 <bitmap xmlns:android="http://schemas.android.com/apk/res/android" 877 android:src="@drawable/icon_ca" /> 878 </pre> 879 880 <p> {@code icon.xml} ( 881 {@code res/drawable-en-rCA/}) {@code R.drawable.icon} {@code 882 R.drawable.icon_ca} ( {@code res/drawable/}) 883 </p> 884 885 886 <h4></h4> 887 888 <p> {@code <merge>} {@code <include>} 889 </p> 890 891 <pre> 892 <?xml version="1.0" encoding="utf-8"?> 893 <merge> 894 <include layout="@layout/main_ltr"/> 895 </merge> 896 </pre> 897 898 <p> {@code main.xml} {@code R.layout.main} {@code R.layout.main_ltr} 899 900 </p> 901 902 903 <h4></h4> 904 905 <p> ID 906 </p> 907 908 <pre> 909 <?xml version="1.0" encoding="utf-8"?> 910 <resources> 911 <string name="hello">Hello</string> 912 <string name="hi">@string/hello</string> 913 </resources> 914 </pre> 915 916 <p>{@code R.string.hi} {@code R.string.hello} </p> 917 918 <p> <a href="{@docRoot}guide/topics/resources/more-resources.html"></a> 919 </p> 920 921 <pre> 922 <?xml version="1.0" encoding="utf-8"?> 923 <resources> 924 <color name="yellow">#f00</color> 925 <color name="highlight">@color/red</color> 926 </resources> 927 </pre> 928 929 930 931 932 <h2 id="Compatibility"></h2> 933 934 <p> 935 </p> 936 937 <p> {@code 938 values/} ()<em></em><a href="#LocaleQualifier"></a> 939 940 {@code values/} 941 ( — ) 942 </p> 943 944 <p> 945 {@code 946 layout-land/} {@code layout-port/} {@code layout/} {@code layout-port/} 947 </p> 948 949 <p> Android 950 951 Android Android 952 953 954 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code 955 minSdkVersion}</a> 4<a href="#NightQualifier"></a> ( API 8 {@code night} {@code notnight}) API 4 956 {@code notnight} {@code drawable/} {@code drawable-night/} 957 958 </p> 959 960 <p> 961 962 </p> 963 964 <p> <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> 4 <em></em><a href="#DensityQualifier"></a> 965 966 Android 967 968 969 </p> 970 971 972 973 <h2 id="BestMatch">Android </h2> 974 975 <p>Android 976 Android 977 978 </p> 979 980 <pre class="classic no-pretty-print"> 981 drawable/ 982 drawable-en/ 983 drawable-fr-rCA/ 984 drawable-en-port/ 985 drawable-en-notouch-12key/ 986 drawable-port-ldpi/ 987 drawable-port-notouch-12key/ 988 </pre> 989 990 <p></p> 991 992 <p style="margin-left:1em;"> 993 = <code>en-GB</code> <br/> 994 = <code>port</code> <br/> 995 = <code>hdpi</code> <br/> 996 = <code>notouch</code> <br/> 997 = <code>12key</code> 998 </p> 999 1000 <p>Android {@code drawable-en-port} 1001 </p> 1002 1003 <p> 1004 </p> 1005 1006 1007 <div class="figure" style="width:371px"> 1008 <img src="{@docRoot}images/resources/res-selection-flowchart.png" alt="" height="471" /> 1009 <p class="img-caption"><strong> 2.</strong>Android 1010 </p> 1011 </div> 1012 1013 1014 <ol> 1015 <li> 1016 <p> <code>drawable-fr-rCA/</code> <code>en-GB</code> 1017 </p> 1018 <pre class="classic no-pretty-print"> 1019 drawable/ 1020 drawable-en/ 1021 <strike>drawable-fr-rCA/</strike> 1022 drawable-en-port/ 1023 drawable-en-notouch-12key/ 1024 drawable-port-ldpi/ 1025 drawable-port-notouch-12key/ 1026 </pre> 1027 <p class="note"><strong></strong> 1028 hdpi 1029 <code>drawable-port-ldpi/</code> 1030 <a href="{@docRoot}guide/practices/screens_support.html"></a> 1031 </p></li> 1032 1033 <li> (<a href="#table2"> 2</a>) () ( MCC ) 1034 </li> 1035 <li> </li> 1036 <ul> 1037 <li> 2 () 1038 </li> 1039 <li> 4</li> 1040 </ul> 1041 </li> 1042 1043 <li> 1044 </li> 1045 <pre class="classic no-pretty-print"> 1046 <strike>drawable/</strike> 1047 drawable-en/ 1048 drawable-en-port/ 1049 drawable-en-notouch-12key/ 1050 <strike>drawable-port-ldpi/</strike> 1051 <strike>drawable-port-notouch-12key/</strike> 1052 </pre> 1053 <p class="note"><strong></strong>Android Android 1054 1055 1056 <a href="{@docRoot}guide/practices/screens_support.html"></a> 1057 </p> 1058 </li> 1059 1060 <li> 23 4 1061 1062 1063 <pre class="classic no-pretty-print"> 1064 <strike>drawable-en/</strike> 1065 drawable-en-port/ 1066 <strike>drawable-en-notouch-12key/</strike> 1067 </pre> 1068 <p> {@code drawable-en-port}</p> 1069 </li> 1070 </ol> 1071 1072 <p> 1073 1074 ("en") (<em></em>) 1075 1076 1077 </p> 1078 1079 <p> () 1080 1081 <em></em><strong></strong> ( {@code xlarge} ) 1082 1083 1084 1085 </p> 1086 1087 <p class="note"><strong></strong><em></em> (<a href="#table2"> 2</a>) 1088 4 () <code>drawable-en</code> () 1089 1090 1091 1092 <code>drawable-port-notouch-12key</code></p> 1093 1094 <p><a href="accessing-resources.html"></a></p> 1095