Android的动作条导航微调文字颜色
问题描述:
我能够改变导航微调的背景:
I am able to change the background of the navigation spinner:
<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>
尽管如此,文字颜色不改变。我也尝试过其他方法来改变文字颜色:
Nevertheless the textColor is not changed. I also tried other ways to change the 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>
任何其他的想法?
Any other idea?
答
我一直在寻找同样的答案,但没有发现任何东西,所以我想这个解决方案。我对我的作品至少。
I was looking for the same answer but didn't find anything, so I tried this solution. I works for me at least.
在主题文件,您可以设置样式为spinnerDropdownItemStyle:
In the themes file, you can set the style for the spinnerDropdownItemStyle:
<style name="YourTheme" parent="YourParentTheme">
<item name="android:spinnerDropDownItemStyle">@style/YourCustomDropDownItemStyle</item>
</style>
现在,设置textappearance为你的风格:
Now, set the textappearance for your style:
<style name="YourCustomDropDownItemStyle" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
<item name="android:textAppearance">@style/YourCustomDropDownItemTextStyle</item>
</style>
和您的自定义textappearance,您可以设置文字的详细信息:
And in your custom textappearance you can set the text details:
<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>
希望这有助于!
Hope this helps!