Nine Patch stretchable Images

Android supports a stretchable bitmap image, called a NinePatch graphic. This is a PNG image in which you define stretchable sections that Android will resize to fit the object at display time to accommodate variable sized sections, such as text strings. You typically assign this resource to the View's background. An example use of a stretchable image is the button backgrounds that Android uses; buttons must stretch to accommodate strings of various lengths

Source file format: PNG — one resource per file

Resource source file location: res/drawable/some_name.9.png (must end in .9.png) Compiled resource datatype: Resource pointer to a NinePatchDrawable. Resource reference name:

• Java: R.drawable.some_file

For more information and examples using NinePatch drawables, see the discussion in 2D Graphics.

0 0

Post a comment