Android:Change the view font by code
import android.app.Activity; import android.graphics.Typeface; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class FontManager { public static void changeFonts(ViewGroup root, Activity act) { Typeface tf = Typeface.createFromAsset(act.getAssets(), "fonts/xxx.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, act); } } } }
You must Sign up as a member of Effecthub to view the content.
ChOw
2013-12-25
A PHP Error was encountered
Severity: Notice
Message: Undefined index: HTTP_ACCEPT_LANGUAGE
Filename: helpers/time_helper.php
Line Number: 22
Latest Posts
- Android: CookieManager removeAllCookie() Crash
- XlistView: A listview which can pull to refresh and load more (1)
- Millions of Android Phones Could Be Affected by the Heartbleed Bug. Check to See if Yours Is One of Them
- TOP 10 ANDROID GAMES FOR MARCH 2014
- Android:Button with different textcolor and background in different states
2270 views 0 comments
You must Sign up as a member of Effecthub to join the conversation.