What is the difference between a regular bitmap and a nine-patch image?

2 votes
128 views
Harsh kumar srivastava asked 10-Jan-2018 in Technology by Harsh kumar srivastava

What is the difference between a regular bitmap and a nine-patch image?

1 Answer

1 votes
Prateek sharma answered 10-Jan-2018 by Prateek sharma

a nine patch image is a stretchable bitmap which has some certain features. this kind of image has all four corners unscaled and edges and centre part of the image is scalable

nine patch image is a standard .png file and stored in res/drawable/  directory of your project.  the image has an extra 1-pixel black border which is considered as the stretchable section of the image which is in the top and left part of the border whereas other parts are indicated as the white or transparent.

in your image, a user can have any number of stretchable section as the relative size remains the same. if these images are used in the background of the text these are automatically fit to the text.