In my application, I provide a setting for user to change the font of the whole application. I want when user choose one from the list, the whole application will immediately apply this font. I have search many questions related to this problem but I can't find a suitable solution. What do I have to do to achieve this? All help is appreciated!
Asked
Active
Viewed 1,218 times
0
-
HOw many fonts you wish to show user for selection – Shankar Agarwal Apr 03 '12 at 17:21
-
I have three different fonts. They appear as a list when user press Setting and choose Change font of application option. – Duc Le Apr 03 '12 at 17:26
-
you must create custom classes for all like TextView,EditText.etc then only you do that – Shankar Agarwal Apr 03 '12 at 17:32
1 Answers
0
I couldnt find a solution now on.
I think the answer is
https://stackoverflow.com/a/9531442/621951
However, I am still investigating to find a solution.
I found a code may be that will be helped.
private void overrideFonts(final Context context, final View v) {
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);
}
} else if (v instanceof TextView ) {
((TextView) v).setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Vegur-R 0.602.otf"));
}
} catch (Exception e) {
}
}

Community
- 1
- 1

Günay Gültekin
- 4,486
- 8
- 33
- 36
-
also this code is working, I used it. [link](http://stackoverflow.com/a/8854794/621951) – Günay Gültekin Apr 04 '12 at 17:08