티스토리 뷰

프로그래밍/Android

Drawable Resources

앙망 2011. 6. 9. 13:55

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 getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon. There are several different types of drawables:

drawable resource 는 스크린에 그릴수 있는 그래픽의 일반적인 개념이다. API를 부르거나 다른 XML 리소스에 적용시킨다. drawables의 여러가지 타입들이 있다.

참고자료


Type

Bitmap File
A bitmap graphic file (.png.jpg, or .gif). Creates a BitmapDrawable.
Nine-Patch File
A PNG file with stretchable regions to allow image resizing based on content (.9.png). Creates a NinePatchDrawable.
Layer List
A Drawable that manages an array of other Drawables. These are drawn in array order, so the element with the largest index is be drawn on top. Creates a LayerDrawable.
State List
An XML file that references different bitmap graphics for different states (for example, to use a different image when a button is pressed). Creates aStateListDrawable.
Level List
An XML file that defines a drawable that manages a number of alternate Drawables, each assigned a maximum numerical value. Creates aLevelListDrawable.
Transition Drawable
An XML file that defines a drawable that can cross-fade between two drawable resources. Creates a TransitionDrawable.
Inset Drawable
An XML file that defines a drawable that insets another drawable by a specified distance. This is useful when a View needs a background drawble that is smaller than the View's actual bounds.
Clip Drawable
An XML file that defines a drawable that clips another Drawable based on this Drawable's current level value. Creates a ClipDrawable.
Scale Drawable
An XML file that defines a drawable that changes the size of another Drawable based on its current level value. Creates a ScaleDrawable
Shape Drawable
An XML file that defines a geometric shape, including colors and gradients. Creates a ShapeDrawable.

Also see the Animation Resource document for how to create an AnimationDrawable.

댓글