3

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">
Giri
  • 931
  • 11
  • 31
  • 51

6 Answers6

6

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>

Giri
  • 931
  • 11
  • 31
  • 51
2

Add the following line in your style.xml for API level 23 and above.

<item name="android:titleTextColor">@color/black</item>
Maihan Nijat
  • 9,054
  • 11
  • 62
  • 110
1

Try this

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

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

<style name="TitleTextColor">
    <item name="android:text">@string/app_name</item>
        <item name="android:textSize">10sp</item>
        <item name="android:textColor">#a23421</item>
</style>
Muhammad Aamir Ali
  • 20,419
  • 10
  • 66
  • 57
0

I guess the attribute name will be android:titleTextStyle instead of android:textAppearance

Ritaban
  • 763
  • 4
  • 8
0

Yas Bro You can do this...

even you made your own custom titlebar ...

Just Go through this link

How to change the text on the action bar

which is from stackoverflow.

Community
  • 1
  • 1
0

Here's a code snippet I found online: It worked perfectly for me.

private void createCustomActionBar() {
    this.getSupportActionBar().setDisplayShowCustomEnabled(true);
    this.getSupportActionBar().setDisplayShowTitleEnabled(false);
    LayoutInflater inflator = LayoutInflater.from(this);
    View v = inflator.inflate(R.layout.title_bar, null);
    Typeface tf = Typeface.createFromAsset(getAssets(),"Lobster-Regular.ttf");
    ((TextView)v.findViewById(R.id.lblActionBarTitle)).setTypeface(tf);
    ((TextView)v.findViewById(R.id.lblActionBarTitle)).setTypeface(tf);
    this.getSupportActionBar().setCustomView(v);
    this.getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#212121")));
}

Call this method just after your setContentView(R.layout.main_activity) line in your main activity. If you are using a standard activity replace the instances of getSupportActionBar with getActionBar.

user2288580
  • 2,210
  • 23
  • 16