1, Android provides three kinds of fonts: "Sans", "serif" and "monospace". Use Android:typeface, such as android:typeface= "monospace".
2. If you want to use a different font,
1) Copy the TTF file of the new font to the assets/fonts/directory, for example, we copy the "*.ttf" to the past.
2) We need to set the widget to that font, which, unfortunately, cannot be done directly in the XML file and requires writing the source code.
TextView TV = (TextView) Findviewbyid (R.id.c12_custom); Typeface face = Typeface.createfromasset (Getassets (), "Fonts/timesi.ttf"); Tv.settypeface (face);
Get the resources from the Assert, get the app's assert, use Getaserts (), by giving the relative path below the assert/. In actual use, the font library may exist on the SD card, you can use CreateFromFile () to replace the Createfromasset.
I have imported Chinese Xingkai fonts in the simulator, about 4M, but the system does not recognize the font, no display, and then try to use the English font Timesi.ttf, normal. Therefore, Android is not compatible with all TTF fonts, especially in the Chinese special font support will be problematic, for incompatible fonts, Android can not error, but not normal display. In general, we will use the default fonts provided by the system