How do you set the title color for the new Toolbar?

android toolbar background color
how to change action bar title color in android
how to change toolbar icon color in android
how to change toolbar text color in android
change toolbar color android
how to change menu icon color in android
how to set toolbar title color in android programmatically
android toolbar menu icon color

I'm using the new v7 Toolbar and for the life of me can't figure out how to change the color of the title. I've set the @style of the Toolbar to a style declared in styles.xml and applied a titleTextStyle with a textColor. Am I missing something? I'm coding for Lollipop but testing currently on a Kitkat device.

styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="@style/Theme.AppCompat.Light">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>

    <style name="ActionBar" parent="Theme.AppCompat">
        <item name="android:background">@color/actionbar_background</item>
        <item name="android:titleTextStyle">@style/ActionBar.TitleTextStyle</item>
    </style>

    <style name="ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/actionbar_title_text</item>
    </style>

</resources>

actionbar.xml:

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar_actionbar"
    android:layout_width="match_parent"
    android:layout_height="?actionBarSize"
    style="@style/ActionBar"/>

If you want to change only title text color than, Try this one. You can define custom tool bar style by extending Widget.AppCompat.Toolbar  Remeber @color/colorText is simply your color.xml file with the color attribute named colorText and your color.This is the best way to calll your strings rather than hardcoding your color inside your toolbar.xml.

Here is my solution if you need to change only color of title and not color of text in search widget.

layout/toolbar.xml

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:background="@color/toolbar_bg"
    app:theme="@style/AppTheme.Toolbar"
    app:titleTextAppearance="@style/AppTheme.Toolbar.Title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"/>

values/themes.xml

<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="windowActionBar">false</item>
    </style>

    <style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.ActionBar">
        <!-- Customize color of navigation drawer icon and back arrow --> 
        <item name="colorControlNormal">@color/toolbar_icon</item>
    </style>

    <style name="AppTheme.Toolbar.Title" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
        <!-- Set proper title size -->
        <item name="android:textSize">@dimen/abc_text_size_title_material_toolbar</item>
        <!-- Set title color -->
        <item name="android:textColor">@color/toolbar_title</item>
    </style>
</resources>

In the similar way, you can set also subtitleTextAppearance.

How do you change the color of the title bar on Android? Personalize the colors of the Start button, taskbar, and action center (this option is only available if you select Dark or Custom as your Windows color) Choose accent colors to contrast with or match your wallpaper and Windows color; Show accent colors for window title bars and borders

If you are supporting API 23 and above, you can now use the titleTextColor attribute to set the Toolbar's title color.

layout/toolbar.xml

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:titleTextColor="@color/colorPrimary"
        />

MyActivity.java

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar)
toolbar.setTitleTextColor(Color.WHITE);

How do I change the color of my status bar text? My code is as below and while it works ( when I change the parent Theme to Theme.Sherlock or Theme.Sherlock.Light the Theme it does changes) it does not changes the Title color. The code is pretty

Setting app:titleTextColor on my android.support.v7.widget.Toolbar works for me on Android 4.4 and on 6.0 too with com.android.support:appcompat-v7:23.1.0:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    app:titleTextColor="@android:color/white" />

How do I change the theme on my Android toolbar? Setting a color property to null resets it to the default system color. You can't set transparent colors. The color's alpha channel is ignored. Windows gives a user the option to apply their selected accent color to the title bar. If you set any title bar color, we recommend that you explicitly set all the colors.

This was annoying me a while and I didn't like any of the answers given, so I had a look at the source to see how it works.

FractalWrench is on the right path, but it can be used below API 23 and doesn't have to be set on the toolbar it's self.

As others have said you can set a style on the toolbar with

app:theme="@style/ActionBar"

and in that style you can set the title text colour with

<item name="titleTextColor">#00f</item>

for pre API 23 or for 23+

<item name="android:titleTextColor">your colour</item>

Full xml

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_height="?attr/actionBarSize"
    android:layout_width="match_parent"
    app:theme="@style/ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"/>


<style name="ActionBar" parent="@style/ThemeOverlay.AppCompat.ActionBar">
    <item name="android:titleTextStyle">@style/ActionBarTextStyle</item>
    <item name="titleTextColor">your colour</item>
    <item name="android:background">#ff9900</item>
</style>

Heres all the attributes that can be set for a toolbar

<declare-styleable name="Toolbar">
    <attr name="titleTextAppearance" format="reference" />
    <attr name="subtitleTextAppearance" format="reference" />
    <attr name="title" />
    <attr name="subtitle" />
    <attr name="gravity" />
    <attr name="titleMargins" format="dimension" />
    <attr name="titleMarginStart" format="dimension" />
    <attr name="titleMarginEnd" format="dimension" />
    <attr name="titleMarginTop" format="dimension" />
    <attr name="titleMarginBottom" format="dimension" />
    <attr name="contentInsetStart" />
    <attr name="contentInsetEnd" />
    <attr name="contentInsetLeft" />
    <attr name="contentInsetRight" />
    <attr name="maxButtonHeight" format="dimension" />
    <attr name="navigationButtonStyle" format="reference" />
    <attr name="buttonGravity">
        <!-- Push object to the top of its container, not changing its size. -->
        <flag name="top" value="0x30" />
        <!-- Push object to the bottom of its container, not changing its size. -->
        <flag name="bottom" value="0x50" />
    </attr>
    <!-- Icon drawable to use for the collapse button. -->
    <attr name="collapseIcon" format="reference" />
    <!-- Text to set as the content description for the collapse button. -->
    <attr name="collapseContentDescription" format="string" />
    <!-- Reference to a theme that should be used to inflate popups
         shown by widgets in the toolbar. -->
    <attr name="popupTheme" format="reference" />
    <!-- Icon drawable to use for the navigation button located at
         the start of the toolbar. -->
    <attr name="navigationIcon" format="reference" />
    <!-- Text to set as the content description for the navigation button
         located at the start of the toolbar. -->
    <attr name="navigationContentDescription" format="string" />
    <!-- Drawable to set as the logo that appears at the starting side of
         the Toolbar, just after the navigation button. -->
    <attr name="logo" />
    <!-- A content description string to describe the appearance of the
         associated logo image. -->
    <attr name="logoDescription" format="string" />
    <!-- A color to apply to the title string. -->
    <attr name="titleTextColor" format="color" />
    <!-- A color to apply to the subtitle string. -->
    <attr name="subtitleTextColor" format="color" />
</declare-styleable>

How do I change the background color of my taskbar in Android? You can remove the space around the address bar by right-clicking on the spaces, and choosing "remove from toolbar". Note the Black Theme is just a Example and can be found in Customize. Note that the line that designates the active tab is taken from your Win10 colours.

I'm using the new v7 Toolbar and for the life of me can't figure out how to change the color of the title. I've set the @style of the Toolbar to a style declared in  YOU CAN NOW CHANGE THE COLOR IN THE SETTINGS OF WINDOWS 10. How to change the color of the Titlebar in Windows 10 (Without changing the Taskbar and Start) NEW way to Change Color/Colour of

Android's new Toolbar, which replaces ActionBar (with some awkward code), makes it easier to change the title text color and the color of the  Click the Toolbars tab, and then click New. In the Toolbar Name box, type a name for your new custom toolbar. In the Make toolbar available to box, click the template or open document where you want to store the toolbar. Click OK. The Customize dialog box appears. Click the Commands tab. Click the category that you want to select your button from.

Hi,Is there a way to set custom text color to the toolbar title only? When i set.

Comments
  • This solution has various side effects. textColorPrimary is applied also on navigation drawer button and text in search widget. Moreover, color of back button is set to white (don't ask me why).
  • @PeterKnut At the time I didn't realize how incomplete the proposed solution was. After edit - this is how I use it and it works. However review the search view text color snippet please.
  • Now it works nearly correctly. Two notes: digging text in search widget is not good idea, its id can be changed in future. Background property in Widget.MyApp.ActionBar influences also background in buttons and tooltips. Background has to be set in <android.support.v7.widget.Toolbar> directly.
  • I concur, it's not a good idea, I'd at least add a null check in there (however what are the odds of that id changing). Concerning the background: You are not right, if you add it as a style to the toolbar element the background applies only to the toolbar widget. If you would define the background in the ThemeOverlay and use it as a theme, then the background of every child element would also get colored.
  • OK, you are right with style vs. theme. My mistake.
  • I was having a problem where the colour of the title would be different depending on whether the toolbar existed in a Fragment or in an Activity. Using this trick to override the colour was the only fix I could find (other ways to change the colour didn't work). I hope this will help more people. Thanks!
  • @Peter Knut you need to specify this only works for API21 and above, which kind of makes it useless
  • @DoruChidean tested with Jelly Bean (API 16) : it works like a charm!
  • Not possible to set theme on activity. IE, <activity android:name=".SomeActivity" android:theme="@style/AppTheme.Toolbar"
  • These seem to be supported by the appcompat library as well.
  • Notice that the namespace is app and not android.
  • simply adding this line app:titleTextColor="@android:color/white" worked for me in kitkat and above also. Thanks @hunyadym
  • Hey, thanks this works. But you know how to use that attribute only in the styles ? Instead of making the xml messier. Thanks :)
  • obviously your @color comes directly from your string resource.That way your xml is neater than hardcoding your colors.
  • While this code may answer the question, it would be better to include some context, explaining how it works and when to use it. Code-only answers are not useful in the long run.