操作栏标题的文字颜色

时间:2014-03-22 14:00:32

标签: android android-appcompat

我不知道我做错了什么,但我不能改变动作栏的文字颜色。我正在使用AppCompat,我希望将文本设置为白色。如果有人可以帮助我,有我的风格。谢谢。

<style name="Theme.Example" parent="@style/Theme.AppCompat.Light">
   <item name="actionBarItemBackground">@drawable/selectable_background_example</item>
    <item name="popupMenuStyle">@style/PopupMenu.Example</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.Example</item>
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Example</item>
    <item name="actionDropDownStyle">@style/DropDownNav.Example</item>
    <item name="actionBarStyle">@style/ActionBar.Solid.Example</item>
    <item name="actionModeBackground">@drawable/cab_background_top_example</item>
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_example</item>
    <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Example</item>
    <item name="android:actionMenuTextColor">@style/MyActionBarTitleText</item>


</style>

<style name="ActionBar.Solid.Example" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
    <item name="background">@drawable/ab_solid_example</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_example</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_example</item>
    <item name="progressBarStyle">@style/ProgressBar.Example</item>
    <item name="actionMenuTextColor">@color/white</item>

    <item name="android:actionMenuTextColor">@color/white</item>

</style>


<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 -->
</style>

2 个答案:

答案 0 :(得分:0)

尝试将MyActionBarTitleText父样式更改为TextAppearance.Holo.Widget.ActionBar.Title

参考: https://developer.android.com/training/basics/actionbar/styling.html#CustomText

答案 1 :(得分:0)

你可以放置&#34; actionMenuTextColor&#34; &#34; Theme.Example&#34;下的属性样式标记,然后重试