Skip to content

Instantly share code, notes, and snippets.

@mahdimortazavi
Last active July 19, 2016 20:19
Show Gist options
  • Save mahdimortazavi/4ebab49077a083e7470d76d6581ad3f7 to your computer and use it in GitHub Desktop.
Save mahdimortazavi/4ebab49077a083e7470d76d6581ad3f7 to your computer and use it in GitHub Desktop.
change font all application
add dependency
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
------------------------------------------------
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/irsensnumeral.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.activity_main);
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment