Accessing a font under assets folder from XML file in Android

后端 未结 14 1178
暖寄归人
暖寄归人 2020-12-05 17:07

I am trying to do a application-wide font change and creating a style file to do so. In this file (below) I just want to change typeface value of TextAppearance style of And

14条回答
  •  既然无缘
    2020-12-05 17:53

    Edit 2:

    Finally fonts are supported by xml (also backwards compatible via support library): https://developer.android.com/preview/features/fonts-in-xml.html


    Edit:

    I now use the Calligraphy library . It is the easiest way for custom fonts.

    What can you do:

    • Custom font in a TextView
    • Custom font in TextAppearance
    • Custom font in Styles
    • Custom font in Themes
    • FontSpannable to only apply font to a part of the text

    I found another way to do this.

    You have to make your own TextView using this tutorial

    It is not that difficult and after this you can just use that TextView with your own font.

    I don't know if anybody still watches this, but I thought it might help.

提交回复
热议问题