From 2316d6260862230af10d8ca3ff446ad3f560f712 Mon Sep 17 00:00:00 2001 From: Scott Main Date: Tue, 20 Jul 2010 09:59:35 -0700 Subject: docs: add information about using color resources as drawables Change-Id: I24d82292b700104294d268894b660bc8b7e5ddb0 --- docs/html/guide/topics/resources/drawable-resource.jd | 13 ++++++++++--- docs/html/guide/topics/resources/more-resources.jd | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'docs/html/guide') diff --git a/docs/html/guide/topics/resources/drawable-resource.jd b/docs/html/guide/topics/resources/drawable-resource.jd index 1e4cca7..1c3cc4d 100644 --- a/docs/html/guide/topics/resources/drawable-resource.jd +++ b/docs/html/guide/topics/resources/drawable-resource.jd @@ -12,9 +12,10 @@ parent.link=available-resources.html -

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:

+

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:

Bitmap File
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}<

Also see the Animation Resource document for how to create an {@link android.graphics.drawable.AnimationDrawable}.

+

Note: A color resource can also be +used as a drawable in XML. For example, when creating a state list +drawable, you can reference a color resource for the {@code android:drawable} attribute ({@code +android:drawable="@color/green"}).

+ diff --git a/docs/html/guide/topics/resources/more-resources.jd b/docs/html/guide/topics/resources/more-resources.jd index 22abbb2..1f03446 100644 --- a/docs/html/guide/topics/resources/more-resources.jd +++ b/docs/html/guide/topics/resources/more-resources.jd @@ -114,8 +114,9 @@ boolean screenIsSmall = res.{@link android.content.res.Resources#getBoolean(int)

Color

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.

+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"}).

The value always begins with a pound (#) character and then followed by the Alpha-Red-Green-Blue information in one of the following formats:

-- cgit v1.1