如果想改变整个布局的字体,你必须递归的遍历整个布局
protected void changeFonts(ViewGroup root) {
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/comicsans.ttf");
for(int i = 0; i <root.getChildCount(); i++) {
View v = root.getChildAt(i);
if(v instanceof TextView ) {
((TextView)v).setTypeface(tf);
} else if(v instanceof Button) {
((Button)v).setTypeface(tf);
} else if(v instanceof EditText) {
((EditText)v).setTypeface(tf);
} else if(v instanceof ViewGroup) {
changeFonts((ViewGroup)v);
}
}
}