Search code examples
androidimagebuttonnine-patch

How to make 9 patch of this image properly?


I have this image for imagebutton, and i need to create patch 9 of it.

enter image description here

How should i make 9 patch, so the text and flag will be strecthed and squeezed correctly? I tried a few things and had no luck.


Solution

  • If you have the original assets for the button, it would make the most sense to separate out the grey button from the yellow text/flag. Creating a 9patch from the button itself will be pretty easy and assign that to the ImageButton background property. Leave the yellow with a transparent background centered as the ImageButton source.