Android Development Tools: Learning About Draw 9-Patch

While I have been able to make Android say hello, I’ve been having trouble creating my first real Android application. I went back to the Android documentation, to see if I could learn something new. Each step forward is one step closer toward my goal. Today I learned about the Draw 9-Patch tool.

Basically, Draw 9-Patch is part of the process to make pretty edges for the windows in your applications. Not just pretty windows, but windows that can scale. If you turn your G1 phone sideways, will the window reshape to match the new perspective? That’s where a “NinePatch” graphic enters the picture. The corners stay the same size, while the edges and the middle scale to the new window size. You can use the Draw 9-Patch tool to set a nine box grid. That determines how the image will reshape itself.

The Windows Command Prompt is getting a lot more action since I installed the Android SDK.
The Windows Command Prompt is getting a lot more action since I installed the Android SDK.

This concept wasn’t too hard for me to understand, as it’s also used in web design. What I found interesting was that a program to make the creation process easier was just sitting on my computer. I created a test PNG file using the Draw 9-Patch program. It was an ugly image, so I won’t post it here, but the point is that I learned something new. If I wrote a list of requirements for my Android application idea, a pretty interface would be on the list. Understanding NinePatch is move towards that goal.