Creating 9 patch image in Android Studio

Updated 3 March 2017


Creating 9 patch PNG image (i.e .9.png image) is very easy but only few of us knows about it. Start with a PNG image, put it in any drawable folder in your project. Now follow the bellow mentioned steps.

Steps For converting PNG to 9 Patch PNG
  1. Rename your image file by right-click then Refactor > Rename and change the extension from .png to .9.png .
  2. Now as you will open the file you will see a window as
  3. On hovering over the icon you will see the vertical and horizontal lines. Drag and set these lines to set the part of the image which will stretch when views length increases like , ( you can zoom in and out for a clear view)
  4. The black lines in 5the above image shows the area to be stretched. You can also see the preview in the right side (marked in red box).
  5. And voilĂ !! You are ready to go.
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home