[英]How do you use Calligraphy with TabLayout in Android Design Support Library for custom Font in xml?
[英]How to use calligraphy library in Android
我想在我的項目中使用書法庫 ,但是在我的應用程序中是使用此代碼來更改google map語言:
@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));
}
或者,您可以提取父BaseActivity
並將書法應用於一個地方的所有活動。 並且僅在地圖活動中覆蓋語言。 在這種情況下,由於每個包裝器將應用於不同的類,因此它看起來像您的原始代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.