Change Spinner Style In Android

Changing themes and styles of Android widgets require you to modify its drawable images. For the Spinner widget, I found it necessary to have the height changed because the default is just too fat.

You need to create your own 9 patch images or you can get the existing one in Android‘s and modify it. A quicker way though is to make use of this great article by Kostya Vasilyev on compact Spinner widgets.

There are already 9 patch images for you to use. If you want it to have a different color then you will have to modify it yourself. But at least there is already a thin image ready for you to use.

This is a screenshot taken from his site showing the slim spinners side-by-side with the regular ones in an HTC Hero smartphone.

And these are his 9 patch images.

To use the images in an XML file, place them in a selector XML file like this and use it in the Spinner tag.

There you have it. Now you have slimmer Spinner widgets for your app! Just make sure when you save these images from my post you replace the -9 in the filename to .9 because all 9 patch images should end with .9.png.

Related Posts Plugin for WordPress, Blogger...

9 comments

  1. Nice guide, but how do you change the text color of the spinner? I mean the spinner closed, not the options text color.

    Thank you.

Leave a Reply

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