Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create nine-patch and use it in my App?

I want to create a nine-patch image and use that in my App but I don't know how to create it?

I've searched through the Android source code on the Web and I can't seem to find any examples of this. I need a tutorial so that I can understand the process.

like image 505
Omid Nazifi Avatar asked Oct 17 '11 11:10

Omid Nazifi


People also ask

How do I create a 9 patch file?

In Android Studio, right-click the PNG image you'd like to create a NinePatch image from, then click Create 9-patch file. Type a file name for your NinePatch image, and click OK. Your image will be created with the . 9.

What is the difference between regular PNG and nine patch image?

A NinePatch graphic is a standard PNG image that includes an extra 1-pixel border. It must be saved with the 9. png extension in the res/drawable/ directory of your project.

What is a NinePatch?

A 9 patch image is a regular png (. PNG) image which is needful for android app developers where they require to wrap any content within a background image without pixelating the background image.


2 Answers

I have searched the best and the simplest answer to make 9-patch image. Now to make the 9 patch image is the easiest task.

From HERE you can make a 9-patch image for all the resolutions - XHDPI,HDPI,MDPI,LDPI in just one click.

Let me know if you have any queries, and do upvote it, if it was helpful to you.enter image description here

like image 74
Gaurav Arora Avatar answered Nov 17 '22 07:11

Gaurav Arora


I just found that awesome alternative 9patch editor (by Mikle Garin) and I think it 1000% better than standard one built in sdk:

Editor JAR download link
Editor source code
Editor official page

enter image description here

like image 45
deviant Avatar answered Nov 17 '22 06:11

deviant