androidandroid-titlebar

How to set the text color of titlebar?


I am using this as the theme.

<style name="ThemeSelector" parent="android:Theme.Light">
    <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>
    <item name="android:textAppearance">@style/TitleTextColor</item>
</style>

<style name="WindowTitleBackground">
    <item name="android:background">@drawable/waterblue</item>        
</style>

<style name="TitleTextColor">
    <item name="android:textColor">@color/white</item>
</style>

With this background image is got assigned but text color is not changing.

In manifest I am using like this.

<application
    android:name="com.example"
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/ThemeSelector">

Solution

  • This is worked for me.

    <resources xmlns:android="http://schemas.android.com/apk/res/android">
    
    <style name="ThemeSelector" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/myTheme.ActionBar</item>        
    </style>
    
    <style name="myTheme.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">@drawable/lblue</item>
        <item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item>
        <item name="android:height">@dimen/app_head_height</item>
    </style>
    
    <style name="myTheme.ActionBar.Text" parent="@android:style/TextAppearance">
        <item name="android:textColor">@color/white</item>
        <item name="android:textSize">@dimen/app_head</item>
    </style>