How to change fontFamily of TextView in Android

后端 未结 30 2463
感动是毒
感动是毒 2020-11-22 01:05

So I\'d like to change the android:fontFamily in Android but I don\'t see any pre-defined fonts in Android. How do I select one of the pre-defined ones? I don\'

30条回答
  •  花落未央
    2020-11-22 01:29

    If you want it programatically, you could use

    label.setTypeface(Typeface.SANS_SERIF, Typeface.ITALIC);
    

    Where SANS_SERIF you can use:

    • DEFAULT
    • DEFAULT_BOLD
    • MONOSPACE
    • SANS_SERIF
    • SERIF

    And where ITALIC you can use:

    • BOLD
    • BOLD_ITALIC
    • ITALIC
    • NORMAL

    All is stated on Android Developers

提交回复
热议问题