Changing the FontStyle of Toolbar in Android

 1 . Create toolbar.xml and add a style to  it android:theme="@style/ToolbarTheme"

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.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/actionbar_bg_color"
android:theme="@style/ToolbarTheme">
</androidx.appcompat.widget.Toolbar>
view raw toolbar.xml hosted with ❤ by GitHub

 2 . Add it in styles.xml

<!-- Toolbar theme -->
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:fontFamily">@font/audiowideregular</item>
</style>
view raw styles.xml hosted with ❤ by GitHub

 3 . Create a directory font inside res directory . Add the font inside it.



Comments