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"> 33 </a></li> 34 </ol> 35 </div> 36 </div> 37 38 <p> , , 39 . 40 , . 41 Android . , 42 43 .</p> 44 45 <p> 46 , {@code R} . 47 <a href="accessing-resources.html"> 48 </a>. , 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/} ( 74 ): -, -, {@code mipmap/} 75 . 76 1.</p> 77 78 <p class="note"><strong>.</strong> . 79 <a href="{@docRoot}tools/projects/index.html#mipmap"> </a>.</p> 80 81 <p class="table-caption" id="table1"><strong> 1.</strong> , 82 {@code res/} .</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> XML, <a href="{@docRoot}guide/topics/graphics/prop-animation.html"> 93 </a>.</td> 94 </tr> 95 96 <tr> 97 <td><code>anim/</code></td> 98 <td> XML, <a href="{@docRoot}guide/topics/graphics/view-animation.html#tween-animation"> 99 </a>. ( , 100 {@code animator/}, 101 ).</td> 102 </tr> 103 104 <tr> 105 <td><code>color/</code></td> 106 <td> XML, . . <a href="color-list-resource.html"> 107 </a></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> . 130 {@code mipmap/} . 131 <a href="{@docRoot}tools/project/index.html#mipmap"> </a>.</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}, {@link android.content.res.Resources#openRawResource(int) 150 Resources.openRawResource()} , {@code R.raw.<em>filename</em>}.</p> 151 <p>, , 152 {@code 153 assets/} ( {@code res/raw/}). {@code assets/} 154 , {@link android.content.res.AssetManager}.</p></td> 155 </tr> 156 157 <tr> 158 <td><code>values/</code></td> 159 <td><p> XML, , , .</p> 160 <p> XML- {@code res/} 161 XML, {@code values/} . 162 {@code <resources>} 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"> 175 </a></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, 188 , <a href="{@docRoot}guide/topics/search/searchable-config.html"> </a>. 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><_></em>-<em><_></em>}. 228 <ul> 229 <li><em>{@code <resources_name>}</em> 230 ( 1).</li> 231 <li><em>{@code <qualifier>}</em> , , 232 ( 2).</li> 233 </ul> 234 <p> <em>{@code <qualifier>}</em>. 235 .</p> 236 <p class="caution"><strong>!</strong> 237 , 2. , 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}, , 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), (MNC) 289 SIM- . , <code>mcc310</code> , 290 <code>mcc310-mnc004</code> Verizon <code>mcc208-mnc00</code> 291 Orange.</p> 292 <p> ( GSM), MCC MNC 293 SIM-.</p> 294 <p> MCC (, 295 ). , 296 <em> </em> ( ). MCC 297 MNC, .</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 315 639-1</a>, 316 <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 317 3166-1-alpha-2</a> ( "{@code r}"). 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> , 356 <a href="{@docRoot}guide/topics/manifest/application-element.html#supportsrtl">{@code 357 supportsRtl}</a> {@code "true"} <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> 17 .</p> 358 <p><em> API 17.</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 . , : 373 ( ). 374 , 375 {@code <N>} .</p> 376 <p>, , 377 600 , , {@code 378 res/layout-sw600dp/}. , 379 600 , 380 . ; <strong> 381 </strong>.</p> 382 <p> . , 383 , 384 , , 385 , . 386 , <em> </em> ( 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> 402 , , 403 , . </p> 404 <p><em> API 13.</em></p> 405 <p>. <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html#requiresSmallest">{@code 406 android:requiresSmallestWidthDp}</a>, , 407 , {@link 408 android.content.res.Configuration#smallestScreenWidthDp}, 409 .</p> 410 <p> 411 . <a href="{@docRoot}guide/practices/screens_support.html"> 412 </a>.</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}, , 425 <code><N></code>. 426 427 / .</p> 428 <p> 429 , , 430 , . 431 , , 432 , 433 , : 434 , .</p> 435 <p><em> API 13.</em></p> 436 <p>. {@link android.content.res.Configuration#screenWidthDp} 437 , .</p> 438 <p> 439 . <a href="{@docRoot}guide/practices/screens_support.html"> 440 </a>.</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> , , 453 <code><N></code>. 454 455 / .</p> 456 <p> 457 , , 458 , . 459 , , 460 , 461 , : 462 , . 463 , (, 464 ), <em></em> ; 465 , , 466 , . 467 <p><em> API 13.</em></p> 468 <p>. {@link android.content.res.Configuration#screenHeightDp} 469 , .</p> 470 <p> 471 . <a href="{@docRoot}guide/practices/screens_support.html"> 472 </a>.</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}: , 486 QVGA . 487 320x426 . QVGA VGA 488 .</li> 489 <li>{@code normal}: , 490 HVGA . 491 320x470 . 492 WQVGA , HVGA , WVGA 493 .</li> 494 <li>{@code large}: , 495 VGA . 496 480x640 . 497 VGA WVGA .</li> 498 <li>{@code xlarge}: 499 HVGA . 500 720x960 . 501 , , 502 . <em> API 9.</em></li> 503 </ul> 504 <p class="note"><strong>.</strong> , 505 <em></em> . 506 , , 507 <a href="#BestMatch"> </a> .</p> 508 <p class="caution"><strong>!</strong> , 509 <em></em> , <strong></strong> , 510 (, {@code 511 xlarge}, ).</p> 512 <p><em> API 4.</em></p> 513 514 <p> . <a href="{@docRoot}guide/practices/screens_support.html"> 515 </a>.</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}: , WQVGA, WVGA, FWVGA</li> 530 <li>{@code notlong}: , QVGA, HVGA VGA</li> 531 </ul> 532 <p><em> API 4.</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> </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}: , 573 , , 574 , 575 </li> 576 <li>{@code appliance}: 577 </li> 578 <li>{@code watch}: </li> 579 </ul> 580 <p><em> API 8, API 13, API 20.</em></p> 581 <p> , 582 - , <a href="{@docRoot}training/monitoring-device-state/docking-monitoring.html"> 583 -</a>.</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><em> API 8.</em></p> 602 <p> , 603 ( ), . 604 {@link android.app.UiModeManager}. <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); 624 160dpi.</li> 625 <li>{@code hdpi}: ; 240dpi.</li> 626 <li>{@code xhdpi}: ; 320dpi. <em> API 627 8.</em></li> 628 <li>{@code xxhdpi}: ; 480dpi. <em> API 629 16.</em></li> 630 <li>{@code xxxhdpi}: ( , . 631 <a href="{@docRoot}guide/practices/screens_support.html#xxxhdpi-note"></a> 632 <em> </em>); 640dpi. <em> API 633 18.</em></li> 634 <li>{@code nodpi}: , 635 .</li> 636 <li>{@code tvdpi}: mdpi hdpi; 213dpi. 637 . , 638 — , mdpi hdpi , 639 . API 13.</li> 640 </ul> 641 <p> 3:4:6:8:12:16 ( 642 tvdpi). , 9x9 ldpi 12x12 mdpi, 18x18 hdpi, 24x24 xhdpi .. 643 </p> 644 <p> 645 , tvdpi, 1,33*mdpi. , 646 100 x 100 mdpi 133 x 133 tvdpi.</p> 647 <p class="note"><strong>.</strong> , 648 <em></em> . 649 , , 650 <a href="#BestMatch"> </a> .</p> 651 <p> , 652 , Android , . <a href="{@docRoot}guide/practices/screens_support.html"> 653 </a>.</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>, 692 <code>keysexposed</code> 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}: .</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 786 1 ( Android 1.0 ) <code>v4</code> API 4 ( Android 787 1.6 ). <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels"> API Android</a> 788 .</p> 789 </td> 790 </tr> 791 </table> 792 793 794 <p class="note"><strong>.</strong> Android 795 1.0, Android . 796 , . , 797 <code>w600dp</code> <code>v13</code>, 798 API 13. - , 799 ( <em> </em>). . 800 <a href="#Compatibility"> 801 </a>.</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> . , 826 , <em></em> 827 <code>drawable-rES-rFR/</code>. , , 828 <code>drawable-rES/</code> <code>drawable-rFR/</code>, . 829 . 830 . . <a href="#AliasResources"> 831 </a> .</li> 832 </ul> 833 834 <p> 835 Android 836 . Android 837 , , <a href="#BestMatch"> 838 </a> ( ). , 839 , Android ( 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 . , , , 855 {@code xml/} .</p> 856 857 <p>, , , {@code icon.png}, 858 . , , 859 . , 860 , 861 . , {@code icon_ca.png} ( 862 , {@code icon.png}), 863 {@code res/drawable/}. {@code icon.xml} {@code 864 res/drawable-en-rCA/} {@code res/drawable-fr-rCA/} {@code icon_ca.png} 865 {@code <bitmap>}. PNG 866 XML, . ( 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/}), , 882 {@code R.drawable.icon}, {@code 883 R.drawable.icon_ca} ( {@code res/drawable/}).</p> 884 885 886 <h4></h4> 887 888 <p> , {@code <include>} 889 , {@code <merge>}. :</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}, , 899 {@code R.layout.main}, {@code R.layout.main_ltr} 900 .</p> 901 902 903 <h4> </h4> 904 905 <p> 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 , , . 941 {@code values/} , ( 942 , , ).</p> 943 944 <p> , , 945 . , {@code 946 layout-land/} {@code layout-port/} , : , 947 {@code layout/} {@code layout-port/} .</p> 948 949 <p> , , 950 , , Android 951 , . , 952 Android, 953 Android , , 954 , . , <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code 955 minSdkVersion}</a> 4 <a href="#NightQualifier"> </a> ({@code night} {@code notnight}, API 956 8), API 4 . 957 , , {@code notnight} 958 , {@code drawable/} {@code drawable-night/}.</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 965 , <em> </em> 966 <a href="#DensityQualifier"> </a>. 967 Android 968 . 969 .</p> 970 971 972 973 <h2 id="BestMatch"> Android </h2> 974 975 <p> , , Android 976 . 977 , Android , , , 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 1001 {@code drawable-en-port}.</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> , 1017 <code>en-GB</code>.</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"> 1031 </a>.</p></li> 1032 1033 <li> () (<a href="#table2"> 2</a>). 1034 ( MCC, .) </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> , 1054 Android , . 1055 , Android , 1056 . . <a href="{@docRoot}guide/practices/screens_support.html"> 1057 </a>.</p> 1058 </li> 1059 1060 <li> 2, 3 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 , . , 1075 ("en"), , , 1076 ( 1077 <em></em> ).</p> 1078 1079 <p> 1080 , , 1081 (, , ). , 1082 <em></em> , 1083 <strong></strong> , , , 1084 (, {@code xlarge}, 1085 ).</p> 1086 1087 <p class="note"><strong>.</strong> <em></em> ( <a href="#table2"> 2</a>) , 1088 , . , 4 , 1089 , (, 1090 ), <code>drawable-en</code> 1091 (). , , 1092 <code>drawable-port-notouch-12key</code> .</p> 1093 1094 <p> <a href="accessing-resources.html"> </a>.</p> 1095