To the app global font mainly divided into two aspects to introduce
First, to set a third-party font to the native interface
1. Getting ready to work-download third-party fonts: Portal
Put the file in the Project assets directory. (General personal custom name a file folder to put the font file, you can also directly into the root directory, but remember to change the reference path)
2. Code implementation
A, custom application, replace the font of the third party with the current system default font
B. Define Style
<style name= "Apptheme.noactionbar" > <item name= "Windowactionbar" >false</item> <item name= "Windownotitle" >true</item> <item name= "Android:typeface" > Monospace</item></style>
C, set the settings in the manifests file application
<application android:name= ". Application. Weexapplication " android:allowbackup=" true " android:icon=" @drawable/app_icon " Android:label= "@string/app_name" android:roundicon= "@drawable/app_icon" Android:supportsrtl= "true" android:theme= "@style/apptheme.noactionbar" >
Note: Note that name is a custom application path and theme is a custom style
Second, to set a third-party font page
1. Loading local HTML pages using local fonts
This is easy, just add the JS code to the local file to
<style>@font-face{font-family:' Mycustomfont ';src:url (' File:///android_asset/fonts/textstyle.ttf '); }P{font-family:"Mycustomfont";font-size:X-large; }Body{margin:0; } </style>
< Body style = ' Font-family:mycustomfont; ' >
2. Load the network HTML page using local fonts
The Web page font conversion can be referred to the following URL: http://blog.csdn.net/aiynmimi/article/details/52777965
Android Global use of third-party fonts