Search code examples
androidandroid-actionbarandroid-stylesandroid-actionbar-compat

Can't change ActionBar title text color


I've been trying to find solution but none worked for me. Activity theme:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/white</item>
    <item name="actionBarTheme">@style/MyActionBar</item>

</style>

<style name="MyActionBar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">@color/colorPrimaryDesignV4</item>
    <item name="android:windowActionModeOverlay">true</item>
    <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
    <item name="colorControlNormal">@color/white</item>
    <item name="android:titleTextStyle">@style/TitleText</item>
</style>

<style name="TitleText" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">#DE0F17</item>
    <item name="android:textSize">20sp</item>
</style>

all the attributes in MyActionBar work fine but last one. Title color and sizes are unaffected no matter what.

how can i change it?


Solution

  • I am using this and it works for me

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="titleTextColor">@android:color/white</item>
        <item name="subtitleTextColor">@android:color/white</item>
    </style>