Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2316d626 authored by Scott Main's avatar Scott Main
Browse files

docs: add information about using color resources as drawables

Change-Id: I24d82292b700104294d268894b660bc8b7e5ddb0
parent 9bc4039a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -12,9 +12,10 @@ parent.link=available-resources.html
  </div>
</div>

<p>A drawable resource is a general concept for a graphic that you
can retrieve with {@link android.content.res.Resources#getDrawable(int)}
and draw on the screen. There are several different types of drawables:</p>
<p>A drawable resource is a general concept for a graphic that can be drawn to the screen and which
you can retrieve with APIs such as {@link android.content.res.Resources#getDrawable(int)} or apply
to another XML resource with attributes such as {@code android:drawable} and {@code android:icon}.
There are several different types of drawables:</p>
<dl>
  <dt><a href="#Bitmap">Bitmap File</a><dt>
    <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
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>




+3 −2
Original line number Diff line number Diff line
@@ -114,8 +114,9 @@ boolean screenIsSmall = res.{@link android.content.res.Resources#getBoolean(int)
<h2 id="Color">Color</h2>

<p>A color value defined in XML.
The color is specified with an RGB value and alpha channel. You can use color resource
any place that accepts a hexadecimal color value.</p>
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. 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
Alpha-Red-Green-Blue information in one of the following formats:</p>