1

I have used Calligraphy library to change the font of entire application. Every thing works fine until I decided to change the text size of navigation drawer. I have defined the following style which is used as app:itemTextAppearance of NavigationView. Now the text size is changed but uses the default system font. This is my style for TextAppearance:

<style name="NavDrawerTextStyle" parent="android:TextAppearance">
    <item name="android:textColor">@color/colorPrimaryDark</item>
    <item name="android:textSize">16sp</item>
</style>

I also tried to define the font using fontPath in the style but still no luck.

Abe
  • 39
  • 7

1 Answers1

0

you should add this line in your appTheme in styles.xml:

<item name="fontPath">fonts/yourFont.ttf</item>

so your appTheme will be like this:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="fontPath">fonts/yourFont.ttf</item>
    </style>

</resources>
faraz khonsari
  • 1,924
  • 1
  • 19
  • 27