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

Commit 3b3e368c authored by Scott Main's avatar Scott Main Committed by Android Git Automerger
Browse files

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

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

* commit '60a20061':
  docs: add information about using color resources as drawables
parents 79102ad0 60a20061
Loading
Loading
Loading
Loading
+10 −3
Original line number Original line Diff line number Diff line
@@ -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>







+3 −2
Original line number Original line Diff line number Diff line
@@ -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>