Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can we change the background color of a spinner?

Tags:

android

I want to change the background color of the spinner. But when I am changing the background of the spinner using the following code in the XML-- android:background="#000000". I am able to change the background but the arrow that is displayed at the right side of the spinner view disapears. Is there any other way to change the backgroundof the spinner without loosing the arrow???

like image 803
prachi sharma Avatar asked Jul 15 '11 10:07

prachi sharma


1 Answers

Add this theme to you spinner:

values/styles.xml

<resources> 
   <style name="MyTheme"> 
    <item name="android:spinnerStyle">@style/StandardSpinner</item>
   </style>
</resources>


<style name="StandardSpinner" parent="@android:style/Widget.Spinner">
    <item name="android:background">@drawable/spinner</item>
</style>

Also look at these :

http://android-er.blogspot.com/2010/12/custom-spinner-with-icon.html

http://www.mokasocial.com/2011/03/easily-create-a-default-custom-styled-spinner-android/

http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog

like image 63
Vinayak Bevinakatti Avatar answered Sep 26 '22 15:09

Vinayak Bevinakatti