java.lang.Object | |
↳ | android.graphics.drawable.Icon |
An umbrella container for several serializable graphics representations, including Bitmaps, compressed bitmap images (e.g. JPG or PNG), and drawable resources (including vectors). Much ink has been spilled on the best way to load images, and many clients may have different needs when it comes to threading and fetching. This class is therefore focused on encapsulation rather than behavior.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Icon.OnDrawableLoadedListener |
Implement this interface to receive a callback when
loadDrawableAsync
is finished and your Drawable is ready.
|
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CREATOR |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create an Icon pointing to a bitmap in memory.
| |||||||||||
Create an Icon pointing to an image file specified by URI.
| |||||||||||
Create an Icon pointing to an image file specified by URI.
| |||||||||||
Create an Icon pointing to a compressed bitmap stored in a byte array.
| |||||||||||
Create an Icon pointing to an image file specified by path.
| |||||||||||
Create an Icon pointing to a drawable resource.
| |||||||||||
Create an Icon pointing to a drawable resource.
| |||||||||||
Parcelable interface
| |||||||||||
Returns a Drawable that can be used to draw the image inside this Icon, constructing it
if necessary.
| |||||||||||
Invokes
loadDrawable(Context) on a background thread
and then runs andThen on the UI thread when finished.
| |||||||||||
Invokes
loadDrawable(Context) on the given Handler
and then sends andThen to the same Handler when finished.
| |||||||||||
Store a color to use whenever this Icon is drawn.
| |||||||||||
Store a color to use whenever this Icon is drawn.
| |||||||||||
Store a blending mode to use whenever this Icon is drawn.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Flatten this object in to a Parcel.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
|
Create an Icon pointing to a bitmap in memory.
bits | A valid Bitmap object
|
---|
Create an Icon pointing to an image file specified by URI.
uri | A uri referring to local content:// or file:// image data. |
---|
Create an Icon pointing to an image file specified by URI.
uri | A uri referring to local content:// or file:// image data. |
---|
Create an Icon pointing to a compressed bitmap stored in a byte array.
data | Byte array storing compressed bitmap data of a type that
BitmapFactory
can decode (see Bitmap.CompressFormat ). |
---|---|
offset | Offset into data at which the bitmap data starts |
length | Length of the bitmap data |
Create an Icon pointing to an image file specified by path.
path | A path to a file that contains compressed bitmap data of
a type that BitmapFactory can decode.
|
---|
Create an Icon pointing to a drawable resource.
context | The context for the application whose resources should be used to resolve the given resource ID. |
---|---|
resId | ID of the drawable resource |
Create an Icon pointing to a drawable resource.
resPackage | Name of the package containing the resource in question |
---|---|
resId | ID of the drawable resource |
Parcelable interface
Returns a Drawable that can be used to draw the image inside this Icon, constructing it
if necessary. Depending on the type of image, this may not be something you want to do on
the UI thread, so consider using
loadDrawableAsync
instead.
Invokes loadDrawable(Context)
on a background thread
and then runs andThen
on the UI thread when finished.
context | Context in which to load the drawable; see
loadDrawable(Context) |
---|---|
listener | a callback to run on the provided |
handler | Handler on which to run andThen .
|
Invokes loadDrawable(Context)
on the given Handler
and then sends andThen
to the same Handler when finished.
context | Context in which to load the drawable; see
loadDrawable(Context) |
---|---|
andThen | Message to send to its target once the drawable
is available. The obj
property is populated with the Drawable.
|
Store a color to use whenever this Icon is drawn.
tint | a color, as in setTint(int) |
---|
Store a color to use whenever this Icon is drawn.
tintList | as in setTintList(ColorStateList) , null to remove tint |
---|
Store a blending mode to use whenever this Icon is drawn.
mode | a blending mode, as in setTintMode(PorterDuff.Mode) , may be null |
---|
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.
Flatten this object in to a Parcel.
dest | The Parcel in which the object should be written. |
---|---|
flags | Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE .
|