Working with 9-patch images

A 9-patch graphic is a stretchable bitmap that allows you to define which areas the system can and can't stretch when it needs to resize your image to fit the current screen.

When you convert a regular image into a 9-patch image, you add an extra 1-pixel-wide border around your image's top and left areas. This 1-pixel border pinpoints exactly which pixels the system should replicate if it needs to create a stretched effect rather than simply resizing the entire image:

Working with 9-patch images

Your border doesn't have to be a continuous line; if there's any area you don't want the system to stretch, just leave the area as a gap in your border. ...

Get Android UI Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.