How to change size of title's text on Action Bar?

malcoauri picture malcoauri · Oct 15, 2012 · Viewed 64.4k times · Source

There is an ActionBar on each Android 4.0 application, and it got a title. I need to make this size less. But I don't understand how I can do it, because ActionBar doesn't provide public methods for it. Remark: I don't want to use custom views.

Answer

Aurélien Guillard picture Aurélien Guillard · Oct 15, 2012

Actually, you can do what you want to customize the ActionBar. It must be done through the Theme. You can do something like this :

<style name="Theme.YourTheme" parent="android:style/Theme">
    <item name="android:actionBarStyle">@style/Theme.YourTheme.Styled.ActionBar</item>
</style>

<style name="Theme.YourTheme.Styled.ActionBar">
    <item name="android:titleTextStyle">@style/Theme.Viadeo.Styled.YourTheme.TitleTextStyle</item>
</style>

<style name="Theme.YourTheme.Styled.ActionBar.TitleTextStyle" parent="@android:style/Widget.TextView">
    <item name="android:textSize">12sp</item>
</style>