How to change the toolbar text size?

Apurva picture Apurva · Feb 12, 2015 · Viewed 86.3k times · Source

I want to change the size of text in Toolbar. Because in my application, Toolbar text has different sizes both for landscape and portrait mode.

Is it possible to change the text size of text in Toolbar?

Answer

Vukašin Manojlović picture Vukašin Manojlović · Mar 25, 2015

Use app:titleTextAppearance:

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="?actionBarSize"
    android:id="@+id/toolbar"
    app:titleTextAppearance="@style/Toolbar.TitleText" />

and override the default title size in a custom style:

<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
    <item name="android:textSize">18sp</item>
</style>

Result:

Screenshot