Search code examples
androidandroid-5.0-lollipopandroid-actionbar-compat

Change ActionBarCompat title color but not other texts color


I'm using last release of support library (V21) which include material themes (under Theme.AppCompat name) and I want to put ActionBar title in white. I tried to achieve it by using textColorPrimary (as it's shown there) attribut in my custom theme

<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
    <item name="colorPrimary">@color/orange</item>
    <item name="colorPrimaryDark">@color/orange_dark</item>
    <item name="colorAccent">@color/white</item>

    <!-- This attribut set text color --> 
    <item name="android:textColorPrimary">@color/white</item>
</style>

With this I got a white actionbar title but all other text (textview, edittext) were white too...

Is there a way to change only actionbar title color with recently released features or the only way is to use a custom style for action bar, just like it was the case with Holo ?


Solution

  • Use @style/Theme.AppCompat.Light.DarkActionBar to invert the text color only in the Action Bar.