setting fonts in Android via typeface
the Android system supports three fonts by default:"sans", "serif", "monospace", in addition to other font files (*.ttf)
Method One: Use the android default font in XML
& lt;! -- sans font -->
<TextView android:id= "@+id/sans"
android:text= "Hello,world"
android:typeface= "Sans"
android:textsize= "20sp"/>
<!-- serifs font -->
<textview android:id= " @+id/serif "
android:text= "Hello,world"
android:typeface= "Serif"
android: Textsize= "20sp"/>
<!-- using the default monospace Span style= "Font-family:simsun;" > font -->
<textview android:id= " @+id/monospace "
android:text= "Hello,world"
android:typeface= "Monospace"
android: Textsize= "20sp"/>
method Two : in Android you can introduce other fonts, first to save the font file in the assets/fonts/directory
1. <!--there is no font set, it will be set in Java code --
<textview android:id= "@+id/custom"
android:text= "Hello,world"
Android:textsize= "20sp"/>
2. Introduction of other font-critical code in Java programs
// Get TextView Control Object
TextView TextView = (TextView) Findviewbyid (r.id.custom);
//Save the font file in the assets/fonts/directory and create the typeface object
Typeface Typeface =typeface.createfromasset (Getassets (), "Fonts/handmadetypewriter.ttf");
//Use fonts
Textview.settypeface (typeFace);
setting fonts in Android via typeface