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

后端 未结 25 2705
日久生厌
日久生厌 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 02:55

    Finally, Google realized the severity of this problem (applying custom font to UI components) and they devised a clean solution for it.

    First, you need to update to support library 26+ (you may also need to update your gradle{4.0+}, android studio), then you can create a new resource folder called font. In this folder, you can put your font resources (.tff,...). Then you need to override the default app them and force your custom font into it :)

    
    

    Note: if you want to support devices with older API than 16, you have to use app namespace instead of android!

提交回复
热议问题