set custom font through xml

后端 未结 5 1782
忘掉有多难
忘掉有多难 2021-01-07 09:17

how can i set a font, whose ttf resides in my assets folder through xml? I know how to do that programmatically but how can you do that via xml? Thanks in adva

5条回答
  •  星月不相逢
    2021-01-07 10:17

    You can include custom fonts under assets/fonts and then using the code from https://github.com/browep/AndroidCustomFontWidgets/

    you can specify the font in your XML, e.g.

    
    

    The code supports FontableTextView and FontableButton, but it's quite easy to extend to support other widget types if you require.

提交回复
热议问题