Ticker

6/recent/ticker-posts

Android : Drawables

Drawables

Drawable resources include bitmaps and NinePatch (stretchable PNG) images. They are stored as indi-
vidual files in the res/drawable folder.

The resource identifier for a bitmap resource is the lowercase filename without an extension.
The preferred format for a bitmap resource is PNG, although JPG and GIF files are also supported.
NinePatch (or stretchable) images are PNG files that mark the parts of an image that can be
stretched. NinePatch images must be properly defined PNG files that end in .9.png. The resource
identifier for NinePatches is the filename without the trailing .9.png.

A NinePatch is a variation of a PNG image that uses a 1-pixel border to defi ne the area of the image
that can be stretched if the image is enlarged. To create a NinePatch, draw single-pixel black lines that
represent stretchable areas along the left and top borders of your image. The unmarked sections won't
be resized, and the relative size of each of the marked sections will remain the same as the image size
changes.

NinePatches are a powerful technique for creating images for the backgrounds of Views or Activities
that may have a variable size; for example, Android uses NinePatches for creating button backgrounds.

Post a Comment

0 Comments