Skip to content Skip to sidebar Skip to footer

Android Change Toolbar Title Color To White

The toolbar title in my application displays grey color instead of white.Below is the code.Please help me!!I have edited the code.I have included java code and entire activity_main

Solution 1:

set the theme of the application to AppTheme in AndroidManifest.xml

Hope this helps.

UPDATE Change the parent of the style to DarkActionBar and see what happesn.

<stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar"><!-- Customize your theme here. --><itemname="colorPrimary">@color/colorPrimary</item><itemname="colorPrimaryDark">@color/colorPrimaryDark</item><itemname="colorAccent">@color/colorAccent</item></style>

Solution 2:

Add this to your theme:

<itemname="actionBarStyle">@style/Widget.ActionBar</item>

And then create this style:

<stylename="Widget.ActionBar"parent="@style/Widget.AppCompat.ActionBar"><itemname="titleTextStyle">@style/TextAppearance.Widget.ActionBar.Title</item><itemname="subtitleTextStyle">@style/TextAppearance.Widget.ActionBar.Subtitle</item></style><stylename="TextAppearance.Widget.ActionBar.Title"parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"><itemname="android:textColor">@color/white</item></style><stylename="TextAppearance.Widget.ActionBar.Subtitle"parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle"><itemname="android:textColor">@color/white</item></style>

Solution 3:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="#ffffff"
    app:theme="@style/ThemeOverlay.AppCompat.Light">

Solution 4:

You can use toolbar inside app bar

<android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:titleTextColor="#FFFFFF" />
    </android.support.design.widget.AppBarLayout>

or in your style.xml file

style.xml

<stylename="AppTheme1"parent="Theme.AppCompat.Light"><itemname="colorPrimary">@color/primary_color</item><itemname="android:actionBarStyle">@style/MyActionBar</item><itemname="android:popupMenuStyle">@style/popupMenuStyle</item></style><stylename="MyActionBar"parent="@android:style/Widget.Holo.Light.ActionBar"><itemname="android:background">@color/primary_color</item><itemname="android:icon">@drawable/ic_logo</item><!--this is you want--><itemname="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item></style><stylename="MyTheme.ActionBar.TitleTextStyle"parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"><itemname="android:textColor">#ffffff</item><itemname="android:textStyle">bold</item></style><stylename="popupMenuStyle"parent="@android:style/Widget.PopupMenu"><itemname="android:popupBackground">@color/new_popup_color</item></style>

Solution 5:

Try this :

<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/HeaderBar"app:theme="@style/ActionBarThemeOverlay"app:popupTheme="@style/ActionBarPopupThemeOverlay"/>

And you can have the full control of your ui elements with these styles:

<stylename="ActionBarThemeOverlay"parent=""><itemname="android:textColorPrimary">#fff</item><itemname="colorControlNormal">#fff</item><itemname="colorControlHighlight">#3fff</item></style><stylename="HeaderBar"><itemname="android:background">?colorPrimary</item></style><stylename="ActionBarPopupThemeOverlay"parent="ThemeOverlay.AppCompat.Light" ><itemname="android:background">@android:color/white</item><itemname="android:textColor">#000</item></style>

Post a Comment for "Android Change Toolbar Title Color To White"