设置 Appcompat 操作栏的文本颜色不起作用

set text color of Appcompat action bar does not work

基本上我遵循了这个关于自定义操作栏的指南https://developer.android.com/training/basics/actionbar/styling.html

并在我的 styles.xml

中采用这种风格
    <style name="Blue" parent="Theme.AppCompat">
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">@color/light_blue</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">@color/dark_blue</item>
    <!-- colorAccent is used as the default value for colorControlActivated
         which is used to tint widgets -->
    <item name="colorAccent">@color/light_blue</item>

    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
    <item name="android:actionMenuTextColor">@color/white</item>

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/MyActionBar</item>
    <item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
    <item name="actionMenuTextColor">@color/white</item>
</style>

使用此自定义操作栏将标题文本更改为白色

    <!-- ActionBar styles -->
    <style name="MyActionBar"
    parent="@style/Widget.AppCompat.ActionBar">
    <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
    <!-- Support library compatibility -->
    <item name="titleTextStyle">@style/MyActionBarTitleText</item>
    <item name="android:subtitleTextStyle">@style/MyActionBarSubtitleText</item>
</style>

<!-- ActionBar title text -->
<style name="MyActionBarTitleText"
    parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textColor">@color/white</item>
    <!-- The textColor property is backward compatible with the Support Library -->
    <item name="textColor">@color/white</item>
</style>

<!-- ActionBar subtitle text -->
<style name="MyActionBarSubtitleText"
    parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textColor">@color/white</item>
    <item name="android:textSize">10sp</item>
    <!-- The textColor property is backward compatible with the Support Library -->
    <item name="textColor">@color/white</item>
    <item name="textSize">10sp</item>
</style>

<!-- ActionBar tabs text -->
<style name="MyActionBarTabText"
    parent="@style/Widget.AppCompat.ActionBar.TabText">
    <item name="android:textColor">@color/white</item>
    <item name="textColor">@color/white</item>
    <!-- The textColor property is backward compatible with the Support Library -->
</style>

但显然文本和图标颜色仍为黑色。我错过了什么吗?

如果您只希望文本为白色,这是 Theme.AppCompat 的默认设置,或者,如果您想要浅色 activity,请使用 Theme.AppCompat.Light.DarkActionBar