evi*_*one 18
也许这会让你开始:
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);
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3249 次 |
| 最近记录: |