John
John

Reputation: 1407

change action bar title color Theme.AppCompat.Light.DarkActionBar android

I wants to change the action bar title color to white in android . and i am using theme in values Theme.AppCompat.Light and values-14 Theme.AppCompat.Light.DarkActionBar
I have tried so far in values folder :

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="android:textColor">@android:color/white</item>
</style>

and values -14 folder

  <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="android:textColor">@android:color/white</item>
</style>

but ActionBar title color is not changing.

Upvotes: 6

Views: 12542

Answers (3)

DoruChidean
DoruChidean

Reputation: 8138

You should also check that in you layout xml file you don't have an android:theme attribute specified, which would have priority over the main theme

Upvotes: 0

Willis
Willis

Reputation: 5336

You can specify the background color of the ActionBar by using the colorPrimary attribute; something like the following:

    <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">@android:color/white</item>
    </style>

The above is a special tag created for AppCompat; you will notice that the android: namespace is omitted.

Upvotes: 5

vintuwei
vintuwei

Reputation: 818

If you are using Theme.AppCompat.Light.NoActionBar do

<android.support.v7.widget.Toolbar  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:minHeight="?attr/actionBarSize"
    android:background="@color/background_material_dark"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

Upvotes: 1

Related Questions