Is it possible to set a custom font for entire of application?

后端 未结 25 2688
日久生厌
日久生厌 2020-11-22 02:44

I need to use certain font for my entire application. I have .ttf file for the same. Is it possible to set this as default font, at application start up and then use it else

25条回答
  •  心在旅途
    2020-11-22 03:05

    As of Android O this is now possible to define directly from the XML and my bug is now closed!

    See here for details

    TL;DR:

    First you must add your fonts to the project

    Second you add a font family, like so:

    
    
        
        
    
    

    Finally, you can use the font in a layout or style:

    
    
    
    

    Enjoy!

提交回复
热议问题