开发者

how can we change the background color of a spinner?

I want to change the background color of the spinner. But when I am changing th开发者_如何学Ce 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???


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜