diff options
Diffstat (limited to 'docs/html/guide/topics/resources')
7 files changed, 61 insertions, 52 deletions
diff --git a/docs/html/guide/topics/resources/animation-resource.jd b/docs/html/guide/topics/resources/animation-resource.jd index eaa698f..6473155 100644 --- a/docs/html/guide/topics/resources/animation-resource.jd +++ b/docs/html/guide/topics/resources/animation-resource.jd @@ -335,7 +335,7 @@ set.start(); <dd> <ul> <li><a href="{@docRoot}guide/topics/graphics/animation.html">Property Animation</a></li> - <li><a href="http://zoso:8080/resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">API Demos</a> for examples + <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">API Demos</a> for examples on how to use the property animation system.</li> </ul> </dd> diff --git a/docs/html/guide/topics/resources/drawable-resource.jd b/docs/html/guide/topics/resources/drawable-resource.jd index 80de9f9..a34ed6c 100644 --- a/docs/html/guide/topics/resources/drawable-resource.jd +++ b/docs/html/guide/topics/resources/drawable-resource.jd @@ -1248,7 +1248,6 @@ the right edge, a right gravity clips the left edge, and neither clips both edge android:drawable="@drawable/android" android:clipOrientation="horizontal" android:gravity="left" /> -</clip> </pre> <p>The following layout XML applies the clip drawable to a View:</p> <pre> diff --git a/docs/html/guide/topics/resources/index.jd b/docs/html/guide/topics/resources/index.jd index 84eac73..3f0f1ee 100644 --- a/docs/html/guide/topics/resources/index.jd +++ b/docs/html/guide/topics/resources/index.jd @@ -28,18 +28,18 @@ to provide compatibility with different configurations, you must organize resour project's {@code res/} directory, using various sub-directories that group resources by type and configuration.</p> -<div class="figure" style="width:421px"> -<img src="{@docRoot}images/resources/resource_devices_diagram1.png" height="137" alt="" /> +<div class="figure" style="width:429px"> +<img src="{@docRoot}images/resources/resource_devices_diagram1.png" height="167" alt="" /> <p class="img-caption"> -<strong>Figure 1.</strong> Two different devices, both using default -resources.</p> +<strong>Figure 1.</strong> Two different devices, each using the default layout +(the app provides no alternative layouts).</p> </div> -<div class="figure" style="width:421px"> -<img src="{@docRoot}images/resources/resource_devices_diagram2.png" height="137" alt="" /> +<div class="figure" style="width:429px"> +<img src="{@docRoot}images/resources/resource_devices_diagram2.png" height="167" alt="" /> <p class="img-caption"> -<strong>Figure 2.</strong> Two different devices, one using alternative -resources.</p> +<strong>Figure 2.</strong> Two different devices, each using a different layout provided +for different screen sizes.</p> </div> <p>For any type of resource, you can specify <em>default</em> and multiple @@ -54,18 +54,16 @@ append an appropriate configuration qualifier to the directory name.</li> </ul> <p>For example, while your default UI -layout is saved in the {@code res/layout/} directory, you might specify a different UI layout to +layout is saved in the {@code res/layout/} directory, you might specify a different layout to be used when the screen is in landscape orientation, by saving it in the {@code res/layout-land/} directory. Android automatically applies the appropriate resources by matching the device's current configuration to your resource directory names.</p> -<p>Figure 1 demonstrates how a collection of default resources from an application are applied -to two different devices when there are no alternative resources available. Figure 2 shows -the same application with a set of alternative resources that qualify for one of the device -configurations, thus, the two devices uses different resources.</p> +<p>Figure 1 illustrates how the system applies the same layout for +two different devices when there are no alternative resources available. Figure 2 shows +the same application when it adds an alternative layout resource for larger screens.</p> -<p>The information above is just an introduction to how application resources work on Android. -The following documents provide a complete guide to how you can organize your application resources, +<p>The following documents provide a complete guide to how you can organize your application resources, specify alternative resources, access them in your application, and more:</p> <dl> diff --git a/docs/html/guide/topics/resources/localization.jd b/docs/html/guide/topics/resources/localization.jd index 9affb15..c2b668d 100755 --- a/docs/html/guide/topics/resources/localization.jd +++ b/docs/html/guide/topics/resources/localization.jd @@ -186,7 +186,7 @@ speak. </p> and can include other types of resources such as animations.
<br>
<code> res/drawable/</code>(required directory holding at least
- one graphic file, for the application's icon in the Market)<br>
+ one graphic file, for the application's icon on Google Play)<br>
<code> res/layout/</code> (required directory holding an XML
file that defines the default layout)<br>
<code> res/anim/</code> (required if you have any
@@ -507,7 +507,7 @@ the new locale. </p> <h2 id="publishing">Publishing Localized Applications</h2>
-<p>The Android Market is
+<p>The Google Play is
the main application distribution system for Android devices. To publish a
localized application, you need to sign your application, version it, and go
through all the other steps described in <a
@@ -521,7 +521,7 @@ different locale, follow these guidelines:</p> href="{@docRoot}guide/publishing/app-signing.html#strategies">Signing
Strategies</a>. </li>
<li>Give each .apk file a different application name. Currently it is
-impossible to put two applications into the Android Market that have exactly the
+impossible to publish two applications on Google Play that have exactly the
same name.</li>
<li>Include a complete set of default resources in each .apk file.</li>
</ul>
@@ -638,7 +638,7 @@ border="0"></td> <tr>
<td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
border="0"></td>
- <td>Upload your .apk file or files to Market, selecting the appropriate
+ <td>Upload your .apk file or files to Google Play, selecting the appropriate
languages as
you upload. (For more details, see <a
href="{@docRoot}guide/publishing/publishing.html">Publishing Your
diff --git a/docs/html/guide/topics/resources/more-resources.jd b/docs/html/guide/topics/resources/more-resources.jd index 972eab9..d37b9f8 100644 --- a/docs/html/guide/topics/resources/more-resources.jd +++ b/docs/html/guide/topics/resources/more-resources.jd @@ -216,27 +216,29 @@ is specified with a number followed by a unit of measure. For example: 10px, 2in, 5sp. The following units of measure are supported by Android:</p> <dl> <dt>{@code dp}</dt> - <dd>Density-independent Pixels - an abstract unit that is based on the physical density of the -screen. These units are relative to a 160 dpi (dots per inch) screen, so <em>{@code 160dp} is -always one inch</em> regardless of the screen density. The ratio of dp-to-pixel will change with the -screen density, but not necessarily in direct proportion. You should use these units when specifying -view dimensions in your layout, so the UI properly scales to render at the same actual size on -different screens. (The compiler accepts both "dip" and "dp", though "dp" is more consistent with -"sp".)</dd> + <dd>Density-independent Pixels - An abstract unit that is based on the physical density of the +screen. These units are relative to a 160 dpi (dots per inch) screen, on which 1dp is roughly equal +to 1px. When running on a higher density screen, the number of pixels used to draw 1dp is scaled up +by a factor appropriate for the screen's dpi. Likewise, when on a lower density screen, the number +of pixels used for 1dp is scaled down. The ratio of dp-to-pixel will change with the screen density, +but not necessarily in direct proportion. Using dp units (instead of px units) is a simple solution +to making the view dimensions in your layout resize properly for different screen densities. In +other words, it provides consistency for the real-world sizes of your UI elements across different +devices.</dd> <dt>{@code sp}</dt> - <dd>Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font + <dd>Scale-independent Pixels - This is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user's preference.</dd> <dt>{@code pt}</dt> <dd>Points - 1/72 of an inch based on the physical size of the screen.</dd> <dt>{@code px}</dt> - <dd>Pixels - corresponds to actual pixels on the screen. This unit of measure is not recommended because + <dd>Pixels - Corresponds to actual pixels on the screen. This unit of measure is not recommended because the actual representation can vary across devices; each devices may have a different number of pixels per inch and may have more or fewer total pixels available on the screen.</dd> <dt>{@code mm}</dt> - <dd>Millimeters - based on the physical size of the screen.</dd> + <dd>Millimeters - Based on the physical size of the screen.</dd> <dt>{@code in}</dt> - <dd>Inches - based on the physical size of the screen.</dd> + <dd>Inches - Based on the physical size of the screen.</dd> </dl> <p class="note"><strong>Note:</strong> A dimension is a simple resource that is referenced diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd index 252c153..b33a097 100644 --- a/docs/html/guide/topics/resources/providing-resources.jd +++ b/docs/html/guide/topics/resources/providing-resources.jd @@ -207,10 +207,10 @@ resources.</p> <h2 id="AlternativeResources">Providing Alternative Resources</h2> -<div class="figure" style="width:421px"> -<img src="{@docRoot}images/resources/resource_devices_diagram2.png" height="137" alt="" /> +<div class="figure" style="width:429px"> +<img src="{@docRoot}images/resources/resource_devices_diagram2.png" height="167" alt="" /> <p class="img-caption"> -<strong>Figure 1.</strong> Two different devices, one using alternative resources.</p> +<strong>Figure 1.</strong> Two different devices, each using different layout resources.</p> </div> <p>Almost every application should provide alternative resources to support specific device @@ -231,6 +231,9 @@ for which these resources are to be used (defined in table 2).</li> </ul> <p>You can append more than one <em>{@code <qualifier>}</em>. Separate each one with a dash.</p> + <p class="caution"><strong>Caution:</strong> When appending multiple qualifiers, you must +place them in the same order in which they are listed in table 2. If the qualifiers are ordered +wrong, the resources are ignored.</p> </li> <li>Save the respective alternative resources in this new directory. The resource files must be named exactly the same as the default resource files.</li> @@ -254,20 +257,14 @@ screen density, but the filenames are exactly the same. This way, the resource ID that you use to reference the {@code icon.png} or {@code background.png} image is always the same, but Android selects the version of each resource that best matches the current device, by comparing the device -configuration information with the qualifiers in the alternative resource directory name.</p> +configuration information with the qualifiers in the resource directory name.</p> <p>Android supports several configuration qualifiers and you can add multiple qualifiers to one directory name, by separating each qualifier with a dash. Table 2 lists the valid configuration qualifiers, in order of precedence—if you use multiple -qualifiers for one resource directory, they must be added to the directory name in the order they +qualifiers for a resource directory, you must add them to the directory name in the order they are listed in the table.</p> -<p class="note"><strong>Note:</strong> Some configuration qualifiers were added after Android 1.0, -so not -all versions of Android support all the qualifiers listed in table 2. New qualifiers -indicate the version in which they were added. To avoid any issues, always include a set of default -resources for resources that your application uses. For more information, see the section about <a -href="#Compatibility">Providing the Best Device Compatibility with Resources</a>.</p> <p class="table-caption" id="table2"><strong>Table 2.</strong> Configuration qualifier names.</p> @@ -290,9 +287,8 @@ names.</p> from the SIM card in the device. For example, <code>mcc310</code> is U.S. on any carrier, <code>mcc310-mnc004</code> is U.S. on Verizon, and <code>mcc208-mnc00</code> is France on Orange.</p> - <p>If the device uses a radio connection (GSM phone), the MCC comes - from the SIM, and the MNC comes from the network to which the - device is connected.</p> + <p>If the device uses a radio connection (GSM phone), the MCC and MNC values come + from the SIM card.</p> <p>You can also use the MCC alone (for example, to include country-specific legal resources in your application). If you need to specify based on the language only, then use the <em>language and region</em> qualifier instead (discussed next). If you decide to use the MCC and @@ -752,6 +748,17 @@ href="#KnownIssues">Known Issues</a> for more information.</p> </table> +<p class="note"><strong>Note:</strong> Some configuration qualifiers have been added since Android +1.0, so not all versions of Android support all the qualifiers. Using a new qualifier implicitly +adds the platform version qualifier so that older devices are sure to ignore it. For example, using +a <code>w600dp</code> qualifier will automatically include the <code>v13</code> qualifier, because +the available-width qualifier was new in API level 13. To avoid any issues, always include a set of +default resources (a set of resources with <em>no qualifiers</em>). For more information, see the +section about <a href="#Compatibility">Providing the Best Device Compatibility with +Resources</a>.</p> + + + <h3 id="QualifierRules">Qualifier name rules</h3> <p>Here are some rules about using configuration qualifier names:</p> @@ -1021,8 +1028,8 @@ drawables from {@code drawable-en-port}.</p> logic:</p> -<div class="figure" style="width:280px"> -<img src="{@docRoot}images/resources/res-selection-flowchart.png" alt="" height="590" /> +<div class="figure" style="width:371px"> +<img src="{@docRoot}images/resources/res-selection-flowchart.png" alt="" height="471" /> <p class="img-caption"><strong>Figure 2.</strong> Flowchart of how Android finds the best-matching resource.</p> </div> diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd index ecd2d48..5f5484e 100644 --- a/docs/html/guide/topics/resources/string-resource.jd +++ b/docs/html/guide/topics/resources/string-resource.jd @@ -358,11 +358,14 @@ values, with non-exhaustive examples in parentheses: <pre> int count = getNumberOfsongsAvailable(); Resources res = {@link android.content.Context#getResources()}; -String songsFound = res.{@link android.content.res.Resources#getQuantityString(int,int) -getQuantityString}(R.plurals.numberOfSongsAvailable, count, count); +String songsFound = res.<a +href="{@docRoot}reference/android/content/res/Resources.html#getQuantityString(int, int, java.lang.Object...)" +>getQuantityString</a>(R.plurals.numberOfSongsAvailable, count, count); </pre> -<p>When using the {@link android.content.res.Resources#getQuantityString(int,int) -getQuantityString()} method, you need to pass the {@code count} twice if your string includes + +<p>When using the <a +href="{@docRoot}reference/android/content/res/Resources.html#getQuantityString(int, int, java.lang.Object...)">{@code +getQuantityString()}</a> method, you need to pass the {@code count} twice if your string includes <a href="#FormattingAndStyling">string formatting</a> with a number. For example, for the string {@code %d songs found}, the first {@code count} parameter selects the appropriate plural string and the second {@code count} parameter is inserted into the {@code %d} placeholder. If your plural |