How to set bold title in Action Bar?

I am editing the style xml trying to get the Activity title bold.

<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#81CFEB</item>
    <item name="android:textStyle">bold</item>
</style>

But only what I can set is the background color desired. I do not why the textStyle is not set to bold.

  • Adding multiple reminders causes them to trigger at the same time
  • How to control landscape and portrait programmatically in android?
  • Disable Lock Screen
  • how to set radio button checked as default in radiogroup with Android
  • how to change key background of any key in Android soft keyboard
  • How to Play local swf files in a webview
  • Anyone know how to solve it?

    Related posts:

    Advanced RecyclerView library - code examples
    String.xml provides me wrong String for ProcessDialog
    LocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER) always returns NULL on Galaxy...
    How to generate Key Hash for facebook SDK In Mac
    How to get the available Screen Height minus Navigation Bar in HoneyComb?
    HTML Select dropdowns are not working in android webview
  • App links not working on Android
  • R.drawable cannot resolve image
  • gradle-android-scala-plugin gives “Could not find matching constructor” error
  • Close virtual keyboard on button press
  • Fighting with SurfaceView, Camera and OpenGL
  • how to get the onWindowFocusChanged on Fragment?
  • 3 Solutions collect form web for “How to set bold title in Action Bar?”

    Can you please try with this:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/MyTheme.MyActionBar</item>
      </style>
    
      <style name="MyTheme.MyActionBar"parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:titleTextStyle">@style/MyTheme.MyActionBar.TitleTextStyle</item>
      </style>
    
      <style name="MyTheme.MyActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:background">#81CFEB</item>
        <item name="android:textStyle">bold</item>
      </style>
    </resources>
    

    For those using AppCompat, you’ll need something like this:

    <style name="MyTheme" parent="Theme.AppCompat">
        <item name="android:actionBarStyle">@style/MyTheme.ActionBar</item>
        <item name="actionBarStyle">@style/MyTheme.ActionBar</item>
    </style>
    
    <style name="MyTheme.ActionBar" parent="Widget.AppCompat.ActionBar.Solid">
        <item name="titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
    </style>
    
    <style name="MyTheme.ActionBar.TitleTextStyle" parent="TextAppearance.AppCompat">
        <item name="android:background">#81CFEB</item>
        <item name="android:textStyle">bold</item>
    </style>
    

    if (Build.VERSION.SDK_INT >= 24) {getSupportActionBar().setTitle(Html.fromHtml(“” + title + ““, 0));}
    else {getSupportActionBar().setTitle(Html.fromHtml(“” + title + ““));}

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.