android.graphics.drawable.Drawable
A Drawable that can rotate another Drawable based on the current level value. ScaleDrawable A Drawable that changes the size of another Drawable based on its current level value. ShapeDrawable A Drawable object that draws primitive shapes.
Known Indirect Subclasses
AnimationDrawable, LevelListDrawable, PaintDrawable, StateListDrawable, TransitionDrawable
AnimationDrawable An object used to create frame-by-frame animations, defined by a series of Drawable objects, which can be used as a View object's background.
LevelListDrawable A resource that manages a number of alternate Drawables, each assigned a maximum numerical value.
PaintDrawable Drawable that draws its bounds in the given paint, with optional rounded corners.
StateListDrawable Lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string ID value.
TransitionDrawable An extension of LayerDrawables that is intended to cross-fade between the first and second layer.
Class Overview
A Drawable is a general abstraction for "something that can be drawn." Most often you will deal with Drawable as the type of resource retrieved for drawing things to the screen; the Drawable class provides a generic API for dealing with an underlying visual resource that may take a variety of forms. Unlike a View, a Drawable does not have any facility to receive events or otherwise interact with the user.
In addition to simple drawing, Drawable provides a number of generic mechanisms for its client to interact with what is being drawn:
The setBounds(Rect) method must be called to tell the Drawable where it is drawn and how large it should be. All Drawables should respect the requested size, often simply by scaling their imagery. A client can find the preferred size for some Drawables with the getIntrinsicHeight() and getIntrinsicWidth() methods.
The getPadding(Rect) method can return from some Drawables information about how to frame content that is placed inside of them. For example, a Drawable that is intended to be the frame for a button widget would need to return padding that correctly places the label inside of itself.
The setState(int[]) method allows the client to tell the Drawable in which state it is to be drawn, such as "focused", "selected", etc. Some drawables may modify their imagery based on the selected state.
The setLevel(int) method allows the client to supply a single continuous controller that can modify the Drawable is displayed, such as a battery level or progress level. Some drawables may modify their imagery based on the current level.
A Drawable can perform animations by calling back to its client through the Drawable.Callback interface. All clients should support this interface (via setCallback(Drawable.Callback)) so that animations will work. A simple way to do this is through the system facilities such as setBackgroundDrawable(Drawable) and ImageView.
Though usually not visible to the application, Drawables may take a variety of forms:
Bitmap: the simplest Drawable, a PNG or JPEG image.
Nine Patch: an extension to the PNG format allows it to specify information about how to stretch it and place things inside of it.
Shape: contains simple drawing commands instead of a raw bitmap, allowing it to resize better in some cases.
Layers: a compound drawable, which draws multiple underlying drawables on top of each other.
States: a compound drawable that selects one of a set of drawables based on its state.
Levels: a compound drawable that selects one of a set of drawables based on its level.
Scale: a compound drawable with a single child drawable, whose overall size is modified based on the current level.
For information and examples of creating drawable resources (XML or bitmap files that can be loaded in code), see Resources and Internationalization.
Summary
Aklımda Kalası Kelimeler
* давайте работать вместе
* Zarf ve Mazruf, Zerafet(xHoyratlık) ile aynı kökten(za-ra-fe) gelir
* Bedesten
* Suç subuta ermiştir - Suç sabit olmuştur
2 Ekim 2010 Cumartesi
Android: Drawable
Kaydol:
Kayıtlar (Atom)