Last active
April 13, 2016 04:05
-
-
Save SeongUgJung/0ee75203c1a820adc25f60ced48a0f06 to your computer and use it in GitHub Desktop.
set font to root view.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TypefaceUtil { | |
public static void setTextTypefaceNormal(View view, Typeface typeface) { | |
if (view instanceof ViewGroup) { | |
ViewGroup viewGroup = (ViewGroup) view; | |
int childSize = viewGroup.getChildCount(); | |
for (int idx = 0; idx < childSize; ++idx) { | |
TypefaceUtil.setTextTypefaceNormal(viewGroup.getChildAt(idx), typeface); | |
} | |
} | |
if (view instanceof TextView) { | |
TextView textView = (TextView) view; | |
if (textView.getTypeface() != typeface) { | |
textView.setTypeface(typeface); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment