How to set fonts in Android
This article focuses on "how to set fonts in Android". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to set fonts in Android.
1. Set the font in the Android XML file
You can use Android:typeface, such as android:typeface= "monospace". In this example, we display android:text= "Hello, World!" in Activity in four ways, which are "Sans", "serif", "monospace" and the system default mode (sans is used by default after testing). There are differences in English fonts, but there seems to be no difference in Chinese fonts. The XML file is as follows:
Java Code: