如果您已经使用了自定义主题(您扩展了基本主题并对其进行了自定义)并且您只想为一项活动自定义微调器,您需要这样做:
<style name="Theme.MyTheme" parent="Theme.Sherlock">
... your other items
</style>
<style name="Theme.MyTheme.Spinner" parent="Theme.MyTheme">
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
</style>
<style name="Spinner" parent="@android:style/Widget.Spinner">
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
</style>
<style name="SpinnerItem" parent="@android:style/Widget.TextView.SpinnerItem">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="SpinnerItem.DropDownItem" parent="@android:style/Widget.Holo.Light.DropDownItem.Spinner">
<item name="android:textColor">@android:color/white</item>
</style>
要在活动中使用这种风格,请使用:
<activity
android:name=".YourActivity"
android:theme="@style/Theme.MyTheme.Spinner" >
</activity>
如果您想为所有活动(您的应用程序)自定义微调器,请将项目Theme.MyTheme.Spinner
从Theme.MyTheme
:
<style name="Theme.MyTheme" parent="Theme.Sherlock">
... your other items
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
</style>