Search code examples
androidxmlandroid-layoutandroid-actionbar

Change color of the title in ActionBar


Can I know how to change the color of the title in ActionBar to black color based on the xml code below? I have tried several methods found but it doesn't really work.

Below are the part of the style xml code:::

<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

<style name="TestingBaseTheme" parent="Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/ActionBarTheme</item>
    <item name="android:actionBarTabTextStyle">@style/ActionBarTabText</item>
    <item name="android:actionMenuTextColor">@color/white</item> 
    <item name="android:textColor">@color/black</item>
</style>

<style name="ActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@color/white</item>
</style>

<style name="ActionBarTabText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/white</item>
</style>

<style name="ActionBarTitleText" parent="@android:TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/yellow</item>
</style>

Solution

  • i found simplest and most easy code

    actionBar.setTitle(Html.fromHtml("<font color='#ff0000'>ActionBarTitle </font>"));