我可以更改导航微调器的背景:
- <style name="MyTheme" parent="android:style/Theme.Light">
- <item name="android:actionBarStyle">@style/MyActionBar</item>
- <item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
- </style>
- <style name="MyDropDownNav" parent="android:style/Widget.Spinner">
- <item name="android:background">@drawable/spinner_white</item>
- <item name="android:textColor">@color/red</item>
- </style>
然而textColor没有改变.我还尝试了其他方法来更改textColor:
- <style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
- <item name="android:background">?color_actionbar</item>
- <item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item>
- </style>
- <style name="myTheme.ActionBar.Text" parent="@android:style/TextAppearance">
- <item name="android:textColor">@color/violet</item>
- </style>
还有其他想法吗?
解决方法
我一直在寻找相同的答案,但没有找到任何答案,所以我尝试了这个解决方案.我至少为我工作.
在themes文件中,您可以设置spinnerDropdownItemStyle的样式:
- <style name="YourTheme" parent="YourParentTheme">
- <item name="android:spinnerDropDownItemStyle">@style/YourCustomDropDownItemStyle</item>
- </style>
现在,为您的样式设置textappearance:
- <style name="YourCustomDropDownItemStyle" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
- <item name="android:textAppearance">@style/YourCustomDropDownItemTextStyle</item>
- </style>
在您的自定义textappearance中,您可以设置文本详细信息:
- <style name="YourCustomDropDownItemTextStyle" parent="@android:style/Widget">
- <item name="android:textColor">@color/white</item>
- <!-- Here you can set the color and other text attributes -->
- </style>
希望这可以帮助!