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.
|
1 2 3 4 5 6 7 8 |
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/slim_spinner_pressed" /> <item android:drawable="@drawable/slim_spinner_normal" /> </selector> <Spinner ..... android:background="@drawable/selector_slim_spinner" ..... /> |
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.