How to change default font of the android app?
There is a grate library for custom fonts in android: custom fonts
Here is a sample how to use it.
In gradle you need to put this line:
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
Then make a class that extends application and write this code:
public class App extends Application {
@Override public void onCreate() {
super.onCreate();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("your font path")
.setFontAttrId(R.attr.fontPath)
.build()
);
}
}
In the activity class put this method before onCreate:
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
In your manifest file write like this:
<application
android:name=".App"
It will change the whole activity to your font!. I'ts simple solution and clean!