am 60a20061: am 2316d626: docs: add information about using color resources as drawables

Merge commit '60a200617791cf4dd3660c514ac6bf17dfcb85de' into gingerbread-plus-aosp

* commit '60a200617791cf4dd3660c514ac6bf17dfcb85de':
  docs: add information about using color resources as drawables
This commit is contained in:
Scott Main
2010-07-20 14:01:33 -07:00
committed by Android Git Automerger
2 changed files with 13 additions and 5 deletions

View File

@@ -12,9 +12,10 @@ parent.link=available-resources.html
</div> </div>
</div> </div>
<p>A drawable resource is a general concept for a graphic that you <p>A drawable resource is a general concept for a graphic that can be drawn to the screen and which
can retrieve with {@link android.content.res.Resources#getDrawable(int)} you can retrieve with APIs such as {@link android.content.res.Resources#getDrawable(int)} or apply
and draw on the screen. There are several different types of drawables:</p> to another XML resource with attributes such as {@code android:drawable} and {@code android:icon}.
There are several different types of drawables:</p>
<dl> <dl>
<dt><a href="#Bitmap">Bitmap File</a><dt> <dt><a href="#Bitmap">Bitmap File</a><dt>
<dd>A bitmap graphic file ({@code .png}, {@code .jpg}, or {@code .gif}). <dd>A bitmap graphic file ({@code .png}, {@code .jpg}, or {@code .gif}).
@@ -51,6 +52,12 @@ current level value. Creates a {@link android.graphics.drawable.ScaleDrawable}<
<p>Also see the <a href="animation-resource.html">Animation Resource</a> document for how to <p>Also see the <a href="animation-resource.html">Animation Resource</a> document for how to
create an {@link android.graphics.drawable.AnimationDrawable}.</p> create an {@link android.graphics.drawable.AnimationDrawable}.</p>
<p class="note"><strong>Note:</strong> A <a
href="{@docRoot}guide/topics/resources/more-resources.html#Color">color resource</a> can also be
used as a drawable in XML. For example, when creating a <a href="#StateList">state list
drawable</a>, you can reference a color resource for the {@code android:drawable} attribute ({@code
android:drawable="@color/green"}).</p>

View File

@@ -114,8 +114,9 @@ boolean screenIsSmall = res.{@link android.content.res.Resources#getBoolean(int)
<h2 id="Color">Color</h2> <h2 id="Color">Color</h2>
<p>A color value defined in XML. <p>A color value defined in XML.
The color is specified with an RGB value and alpha channel. You can use color resource The color is specified with an RGB value and alpha channel. You can use a color resource
any place that accepts a hexadecimal color value.</p> any place that accepts a hexadecimal color value. You can also use a color resource when a
drawable resource is expected in XML (for example, {@code android:drawable="@color/green"}).</p>
<p>The value always begins with a pound (#) character and then followed by the <p>The value always begins with a pound (#) character and then followed by the
Alpha-Red-Green-Blue information in one of the following formats:</p> Alpha-Red-Green-Blue information in one of the following formats:</p>