如何更改Android 5.0棒棒糖中的ActionBar文本颜色?

如何更改Android 5.0棒棒糖中的ActionBar文本颜色?,android,android-actionbar,Android,Android Actionbar,如何将Android棒棒糖中的ActionBar文本颜色从黑色更改为白色 这是我目前的风格 <style name="AppCustomTheme" parent="@style/Theme.AppCompat.Light"> <!-- colorPrimary is used for the default action bar background --> <item name="colorPrimary">@color/orange_ba

如何将Android棒棒糖中的
ActionBar
文本颜色从黑色更改为白色

这是我目前的风格

<style name="AppCustomTheme" parent="@style/Theme.AppCompat.Light">
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">@color/orange_bar</item>
</style>

@颜色/橙色/黄色

使用
@style/Theme.AppCompat.Light.darkaActionBar
交换文本和许多其他属性的颜色,以更好地适应深色的操作栏。

我阅读了更多内容,并设法发现您需要添加此标记,以便在Android棒棒糖中更改操作栏的默认颜色

    <!--textColorPrimary is used to change the text color of the default action bar-->
    <item name="android:textColorPrimary">#FFFFFF</item>

#FFFFFF

5.0棒棒糖和
4.4 KitKat

<style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    <!-- To change action bar text color -->
    <item name="android:textColorPrimary">#123</item>

    <!-- This has to be here to make it work; let me know if you know why -->
    <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item>        

</style>

#123
@style/ThemeOverlay.AppCompat.ActionBar

这似乎是一个更好的解决方案,因为例如,仅将textColorPrimary设置为白色也会更改下拉菜单上的文本,使其难以阅读。使用DarkActionBar会使操作栏上的文本变为白色,但会使菜单上的文本变为黑色。