Advanced 9Patch drawing in android
Drawing 9patch can turn into a nightmare easily. I would like to present the other side. The most common problem, to create draws wich are look well in portrait mode and landscape mode too.
Here are some 9patch technics:
(Note: This article don’t tell the basics of 9patching. If you are new in this technics, examine this page first: http://developer.android.com/g
(From this link, you can download the files: download the 9patch files)
Example One: Simple button
This is a just simple button, with a glowing effect. The 9patching wich I use here, keeps the button’s edges, so it keeps the rounded rectangle’s radius too. With 9patch, the content area of the button can be set easily.
Exapmle Two: Spinner button
This is a chooser button, with the same glowing effect. With this 9patching, the dropdown arrow keeps it’s size at horizontal stretching. The glowing effect stays in the middle of the button.
Example Three: Article header image
In this case, I use an extra transparent line before and below the image. The 9patch stretches this lines out. The picture always align to the right top corner of the layout. This can be a spectacular articleheader background.
Example Four: Header background
Like at web pages, larger background images can created easily from a tiny picture. This 9patch stretches the middle of the image, so it’s look like continuous. The lenght of the layout doesn’t matter. For example, this is useful when creating menu bars.
Example Five: Header background 2
In this example, I use the last column of the image, for horizontal stretch. This must be a single-color column. The image starts at the left side of the layout, in any cases, and fill the end with the single-color.
Example Six: Search EditText
You can create your own, horizontal stretch - independent EditText with 9patching. Take care of setting the content area of the image, see it below.
From this link, you can download the files: download the 9patch files
New tutorials from Helloandroid
Recent Apps
Android on Twitter
-
@Idevicegazette (iDevice Gazette)
GSM-to-Skype bridge lets you lose those roaming fees http://bit.ly/lbRJeh #android
12 years 4 weeks ago -
@tommy_banane (tom b.)
RT @AndroidFavorite: #Android New Desktop Android Market Is Live, Adds Several New Features http://zorr0.nl/lFwXNz
12 years 4 weeks ago -
@dwilliams5 (Dennis Williams)
just completed a runtastic run of 3.02 km in 40 min 11 s with #runtastic #Android App: http://tinyurl.com/5tvrpe3
12 years 4 weeks ago -
@S_Pinz (Spinz!)
RT @Androidheadline: Out of box #LG Optimus 3D got Quadrant 2420 score. Thanks @blink_c #io2011 #android http://twitpic.com/4whkdz
12 years 4 weeks ago -
@tayaitapps (Taya IT)
Next Google TV Looks A Lot Like Android http://t.co/dvlTim3 via @alleyinsider #google #apple #android #tv #honeycomb
12 years 4 weeks ago
Poll
Useful resources
Android Development Projects
- App Development
- Telegram bulk messages sender
- Photo Editing Application
- React Native Developer - part time basis
- Locket App Copy
- Courier app $150 only
- Mobile Application Development - IOS and Android (Rewards for sharing brand ads on social media)
- Android app for sms
- Fitness app project for sale online
- io developer