操作栏福尔摩斯4标题字体颜色 - 我要去哪里错了?福尔摩斯、我要、错了、去哪里

2023-09-06 01:55:24 作者:大哥

我有困难,使我的操作栏标题字体颜色白走。有跟随的例子,我相信我的code是正确的,但是文字显示为黑色。

I'm having difficulty making my Action Bar title text colour go white. Having followed examples I believe my code is correct, however the text appears black.

有人能看到我在做什么错了?

Can anyone see what I am doing wrong?

<resources>
    <style name="Theme.MyApp" parent="Theme.Sherlock.Light">
        <item name="actionBarStyle">@style/Widget.MyApp.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.MyApp.ActionBar</item>
        <item name="titleTextStyle">@style/Widget.MyApp.TitleTextStyle</item>
        <item name="android:titleTextStyle">@style/Widget.MyApp.TitleTextStyle</item>
    </style>

    <style name="Widget.MyApp.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
        <item name="background">@drawable/gradient_blue</item>
        <item name="android:background">@drawable/gradient_blue</item>
    </style>

    <style name="Widget.MyApp.TitleTextStyle" parent="Widget.Sherlock.Light.ActionBar">
        <item name="titleTextStyle">@color/white</item>
        <item name="android:titleTextStyle">@color/white</item>
    </style>
</resources>

提前感谢!

推荐答案

使用以下,只需定制 actionBarStyle 属性:

Use the following, just customize the actionBarStyle property:

<resources>
    <style name="Theme.MyApp" parent="Theme.Sherlock.Light">
        <item name="actionBarStyle">@style/Widget.MyApp.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.MyApp.ActionBar</item>
    </style>

    <style name="Widget.MyApp.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
        <item name="titleTextStyle">@style/Widget.MyApp.TitleTextStyle</item>
        <item name="android:titleTextStyle">@style/Widget.MyApp.TitleTextStyle</item>
    </style>

    <style name="Widget.MyApp.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
        <item name="android:textColor">@color/white</item>
    </style>
</resources>

和您可以自定义 TEXTSIZE 称号了。

and you can customize textSize of title too.