3
votes

I was wondering how to change the font of the ActionBar. I'm using Theme AppCompat 23 and I've tried with "typeface", tried with "titleTextStyle" , but nothing happens and I can't explain why... I've tried to do a text style and changed the typeface but still no result. The only thing I can do is change the color of the title with "textColorPrimary". I couldn't find a solution in the specification too. Can someone give me a hint how to do that?

1

1 Answers

5
votes

I resolved my problem creating a custom action bar style and custom title text style: In the app theme:

<style name="Theme.AppLib" parent="Theme.AppCompat.Light">
    <item name="android:typeface">serif</item>
    <item name="actionBarStyle">@style/Theme.AppLib.ActionBar.Solid</item>
</style>

And the styles:

<style name="Theme.AppLib.ActionBar.Solid" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
    <item name="background">@drawable/cab_background_top</item>
    <item name="titleTextStyle">@style/Theme.AppLib.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.AppLib.ActionBar.TitleTextStyle" parent="">
    <item name="android:textColor">@color/text_dark</item>
    <item name="android:textSize">18sp</item>
</style>