How to change fontFamily of TextView in Android

后端 未结 30 2485
感动是毒
感动是毒 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:52

    You can also do this by adding a font folder under the res directory like below.

    Then, selecting Font as the resource type.

    You can find avaliable fonts from https://www.1001fonts.com/, and then extracting the TTF files to this font directory.

    Finally, just change the XML file that contains your textview by adding android:fontFamily:"@font/urfontfilename"

提交回复
热议问题