[GUIDE] Draw9Patch Tool (2025)

Search This thread

LeoMar75

Retired Recognized Developer / Retired Forum Mod
Apr 20, 2011
3,102
6,252
49
Pescara
  • Aug 30, 2011
  • #1

Hi guys,

Since i have received several requests on how to create a NinePatch graphic for .9.png images i made this guide that will cover this topic!

This video tutorial shows how use Draw 9-patch tool, it allows you to easily create a NinePatch graphic using a WYSIWYG editor.
Draw9patch application is located inside your Android SDK /tools directory.

Unfortunately, I have seen most themers around here that don't know how to properly edit .9.png!

Usually, when i decompile a themed apk i always receive warning for bad patches and this is really bad... you guy should know that this is the ABC for themers!

Below, an example of a decompiled framework-res.apk with bad 9.png image patch:

Code:

I: Loading resource table...I: Decoding resources...W: Cant find 9patch chunk in file: "drawable-hdpi/btn_toggle_on.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/btn_dropdown_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/grid_selector_background_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/list_selector_background_longpress.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/menuitem_background_focus.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/menuitem_background_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/gallery_unselected_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/grid_selector_background_focus.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/btn_dropdown_disabled_focused.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/status_bar_item_background_focus.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/frame_gallery_thumb_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/btn_keyboard_key_trans_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/btn_media_player_selected.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/quickcontact_badge_small_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/gallery_selected_focused.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/list_selector_background_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/list_selector_background_focus.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/gallery_selected_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/btn_dropdown_selected.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/quickcontact_badge_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/btn_media_player_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/frame_gallery_thumb_selected.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/highlight_selected.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/highlight_pressed.9.png". Renaming it to *.png.W: Cant find 9patch chunk in file: "drawable-hdpi/status_bar_item_background_pressed.9.png". Renaming it to *.png.I: Copying assets and libs...

This happen because themers edit .9.png by using directly Gimp or Photoshop and don't know that this kind of format need to be patched and recompiled after editing!

In addition when you get this kind of warning you can't recompile apk, you can only remove the bad .9.png images and leave the .png image that apk-manager (or whatever tool you are using) has created! Therefore you will lose important information for padding and stretching rules that comes with .9.png format!

You can't recompile the apk because you will have 2 filename with the same ID public resource!

Also you need to know that bad .9.png images can lead to bootloop issue and also problem with text overlapping and bad stratching for images expecially when the device is in landscape mode.

Draw9patch Tutorial [HD]

I recommend to watch it on youtube because here you can't really see..

Hope it can help!

P.S.
Please don't care about my english, i know that is bad [GUIDE] Draw9Patch Tool (2)[GUIDE] Draw9Patch Tool (3)[GUIDE] Draw9Patch Tool (4)

Last edited:

  • [GUIDE] Draw9Patch Tool (5)

Reactions:

enryea123, fuloplori, brainmaster and 6 others

Nitroz

Senior Member
Jan 13, 2011
1,793
1,845
Wakefield
nitroz.org
  • Aug 30, 2011
  • #2

Great work on this LeoMar, I already knew how to patch .9.png's anyway but it's good for a reference, I had to learn it the hard way [GUIDE] Draw9Patch Tool (7)

carlos67

Senior Member
Oct 29, 2010
1,716
633
  • Aug 30, 2011
  • #4

Leo, your English is excellent. Far better than my Italian!!!!!!!

Thanks.

R

Remoteconcern

Senior Member
May 27, 2011
769
292
  • Aug 30, 2011
  • #5

carlos67 said:

Leo, your English is excellent. Far better than my Italian!!!!!!!

Thanks.

Agreed!
If I could talk about decompilation and .9.pngs in Italian, I'd be a happy man [GUIDE] Draw9Patch Tool (9)

fabioascoelho

Senior Member
Jun 7, 2011
97
6
  • Aug 30, 2011
  • #6

Thx Leo!
Great tutorial and great video. And your English is perfectly understandable.

LeoMar75

Retired Recognized Developer / Retired Forum Mod
Apr 20, 2011
3,102
6,252
49
Pescara
  • Aug 30, 2011
  • #8

DruNKfuX said:

Nice tutorial thanks, now we should make one for you how to clean up your desktop [GUIDE] Draw9Patch Tool (13)

lol that's true... and that was 1280x720 for recoding, if you see my fullhd resolution you will see more icons... [GUIDE] Draw9Patch Tool (14)[GUIDE] Draw9Patch Tool (15)[GUIDE] Draw9Patch Tool (16)

Lg_X_Modderer

Senior Member
Apr 8, 2011
208
124
[Germany VHM]
  • Aug 31, 2011
  • #9

Draw 9 Patcher

Here's a draw 9 the patcher is not always the manager must use apk

View attachment xUltimate-d9pc-x64.zip

have a test folder can simply run the exe, then you will get one done, the folder are then ready patched

deodext here's a car deodexer simply run the jar in the folder and the Main Skip.bat and then 3 and then wait until he has four, wait until he is ready ....

That's your rom is deodex

View attachment xUltimate-v2.2.8.zip

Last edited:

LeoMar75

Retired Recognized Developer / Retired Forum Mod
Apr 20, 2011
3,102
6,252
49
Pescara
  • Aug 31, 2011
  • #10

Lg_X_Modderer said:

Here's a draw 9 the patcher is not always the manager must use apk

View attachment 705743

have a test folder can simply run the exe, then you will get one done, the folder are then ready patched

deodext here's a car deodexer simply run the jar in the folder and the Main Skip.bat and then 3 and then wait until he has four, wait until he is ready ....

That's your rom is deodex

View attachment 705745

I prefer to patch 9.png images manually, because each png has different shape and differtent rules for padding and streaching. Automatic process are bad for this propose but i undertand that it will let you to save time!

Thanks anyway! I knew this tool! [GUIDE] Draw9Patch Tool (19)

Lg_X_Modderer

Senior Member
Apr 8, 2011
208
124
[Germany VHM]
  • Aug 31, 2011
  • #11

This tool does not the picture so you must patch the man do so manually .. he dashes away only makes the man for the framework so that they can use eg

  • [GUIDE] Draw9Patch Tool (21)

Reactions:

LeoMar75

LeoMar75

Retired Recognized Developer / Retired Forum Mod
Apr 20, 2011
3,102
6,252
49
Pescara
  • Aug 31, 2011
  • #12

Lg_X_Modderer said:

This tool does not the picture so you must patch the man do so manually .. he dashes away only makes the man for the framework so that they can use eg

Thanks, i will check it out!

If i got what you said, this tools has an option to compile .9.png images.

Lg_X_Modderer

Senior Member
Apr 8, 2011
208
124
[Germany VHM]
  • Aug 31, 2011
  • #13

yes it has ...

You must log in or register to reply here.

[GUIDE] Draw9Patch Tool (2025)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 5594

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.