---
title: "How to change the Toolbar font on Android"
source: "/writing/how-to-change-the-toolbar-font-on-android/"
---

Article

# How to change the Toolbar font on Android

Andrew Haisting

May 10, 2018

A quick search on our beloved-yet-fickle [Stack Overflow](https://stackoverflow.com/) yields a handful of strategies for changing the font of the Toolbar. Top solutions include [defining a custom Toolbar layout](https://stackoverflow.com/a/32398137/2378694) , setting [text appearance at runtime](https://stackoverflow.com/a/45895693/2378694) , or worst of all, [iterating through every Toolbar view](https://stackoverflow.com/a/35349713/2378694) .

_What gives? I just want to change the font!_

## Step 0: Add the support library. Set minSdk to 16+.

dependencies {    implementation **'com.android.support:appcompat-v7:27.1.1'**

## Step 1: Make a folder. Add a font to it.

Create a new directory, `res/font`. Add a `.ttf` file for the font you want to use. ( [Google Fonts](https://fonts.google.com/) is a sweet place to browse)

## Step 2: Define a Toolbar theme.

_<!-- styles.xml -->_
<**style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Light"**>
    <**item name="android:fontFamily"**>@font/pacifico</**item**>
</**style**>

## Step 3: Add a toolbar to your layout. Give it your new theme.

<!-- Use android:theme NOT style -->
<**android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="@color/colorPrimary"
    android:theme="@style/ToolbarTheme"**/>

## Step 4: Set Toolbar in your Activity.

**override fun** onCreate(savedInstanceState: Bundle?) {
    **super**.onCreate(savedInstanceState)
    setContentView(R.layout._activity_main_)

    **val** toolbar = findViewById<Toolbar>(R.id._toolbar_)
    setSupportActionBar(toolbar)

## Step 5: Enjoy

_Andrew builds apps at_ [_Livefront_](http://livefront.com) _._

-   Andrew Haisting

    Software Engineer

    Andrew Haisting

### Tags

[Digital Engineering](/insights/all/?topic=digital-engineering) [Mobile Apps](/insights/all/?topic=mobile-apps)

### Share

-   Copied

## View these next.

[See all](/insights/all/?type=writing)

-   [

    Article

    How To Sabotage Your Project Using Inconsistency

    Collin Flynn

    ](/writing/how-to-sabotage-your-project-using-inconsistency/)
-   [

    Article

    Unit Testing race conditions by creating chaos (Swift)

    Sean Berry

    ](/writing/unit-testing-race-conditions-by-creating-chaos-swift/)
-   [

    Article

    UIApplicationDelegate call sequence reference

    Sean Berry

    ](/writing/uiapplicationdelegate-call-sequence-reference/)
