如何在Android中使用书法库

如何在Android中使用书法库,android,calligraphy,Android,Calligraphy,我想在我的项目中使用,但在我的应用程序中使用以下代码更改谷歌地图语言: @Override protected void attachBaseContext(Context newBase) { } 对于书法,我应该使用以下代码: @Override protected void attachBaseContext(Context newBase) { super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase)); }

我想在我的项目中使用,但在我的应用程序中使用以下代码更改谷歌地图语言:

@Override
protected void attachBaseContext(Context newBase) {
}
对于书法,我应该使用以下代码:

@Override
protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}

如何在我的项目中使用两个attachBaseContext?

实际上很简单,只需将其链接起来:

@Override
protected void attachBaseContext(Context newBase) {
    newBase = MyContextWrapper.wrap(newBase, "fa_IR");
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
或者,您可以提取一个父活动,并在一个位置将书法应用于您的所有活动。并仅在映射活动中覆盖语言。在这种情况下,它将看起来像您的原始代码,因为每个包装器将应用于不同的类中