Skip to main content

Posts

Showing posts from November, 2012

Android Studio How to use 9 patch png?

Hi, 2nd blog post after almost 1.5 year :) Today I'm going to discuss about 9 patch image and how to use 9 patch png in android apps. What is 9 patch? 9 patch is technique used to scale the image in such a way that the 4 corners remain unscaled, but the four edges are scaled in one axis and the middle is scaled in both axis. So the graphical representation of this scenario will be something like this: Icon when divided into 9  patch Simple Icon file The image at left side when divided into 9 patch will look like the image at the right side. Now the interesting part, the four corners of the image will be remain unscaled and the edges will be scaled in single axis, which may be X or Y. and the center of the 9 patch image will be scaled in both axis. Now we include an image which will represent the parts of image unscaled, scaled into Y axis and scaled into Y and scaled into both direction with color differentiation. Here it is. 9 patch parts represented w