How to set custom font for my entire application

I wanted to set custom font for app but I’m receiving an error

I tried to set custom font for my app using the method I saw from google. I added a font resource folder but I got an error saying ‘ aapt : invalid resource directory name My app/app/src/main/res font ‘ .Please what do I do?

  • I think the problem is caused by the font with aapt. It usually has the .otf extension as far as I know. If you download a font with .otf, maybe the problem can be solved.maybe it will work

    – 




  • Please provide enough code so others can better understand or reproduce the problem.

    – 
    Bot

after you created your font folder, you have to place your font file into that folder and then reference to that file in your application theme style

so go to themes folder of your project and edit the style for the application theme, adding the item “android:fontFamily”

<style name="Theme.MyApplication"....>
...

<item name="android:fontFamily">@font/myfontname</item>

...
</style>

Leave a Comment