我正在使用继承自己的自定义主题,DarkActionBar我想将自定义下拉菜单设置为白色,就像使用Light Holo主题一样.
我已经能够使用以下方法将背景更改为白色:
<style name="MyTheme" parent="@style/Theme.Light.DarkActionBar">
<item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
</style>
<style name="MyDropDownNav">
<item name="android:background">@drawable/spinner_background_white</item>
<item name="android:popupBackground">@drawable/menu_dropdown_panel_whyite</item>
<item name="android:dropDownSelector">@drawable/selectable_background_white</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但我没有任何关于如何将文字颜色改为黑色的线索.因为在设置白色drawable之后问题是文本不可见因为在白色背景是白色的.
我可以更改导航微调器的背景:
<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>
Run Code Online (Sandbox Code Playgroud)
然而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>
Run Code Online (Sandbox Code Playgroud)
还有其他想法吗?