یه راه ساده تر اینه یه view group رو به این تابع پاس بدید همه رو به یکباره تغییر فونت بده یا میتونید فقط یه ویجت بهش نسبت بدید
public static void overrideFonts(final Context context, final View v, PersianFontType fontType) {
String font_family = "";
switch (fontType) {
case PARASTOO_REQULAR:
font_family = "fonts/parastoo_reqular.ttf";
break;
case PARASTOO_BOLD:
font_family = "fonts/parastoo_bold.ttf";
break;
case PARASTOO:
font_family = "fonts/parastoo.ttf";
break;
case SAHEL_BLACK:
font_family = "fonts/sahel_black.ttf";
break;
case SAHEL_BOLD:
font_family = "fonts/sahel_bold.ttf";
break;
case SAHEL:
font_family = "fonts/sahel.ttf";
break;
case VAZIR_BOLD:
font_family = "fonts/vazir.ttf";
break;
case VAZIR:
font_family = "fonts/vazir_bold.ttf";
break;
case VAZIR_LIGHT:
font_family = "fonts/vazir_light.ttf";
break;
}
try {
if (v instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) v;
for (int i = 0; i < vg.getChildCount(); i++) {
View child = vg.getChildAt(i);
overrideFonts(context, child, fontType);
}
} else if (v instanceof TextView) {
((TextView) v).setTypeface(Typeface.createFromAsset(context.ge tAssets(), font_family));
}
} catch (Exception e) {
Log.e("ERROR Override fonts", e.getMessage());
}
}