In my application I need to use helvetica font for all the textviews and edit-text fields. Is there any way to do this other than using settypeface method for every textview ? Any suggestion would be a great help.
Thanks in advance !
1 - Right-click the res folder and go to New > Android resource directory. The New Resource Directory window appears. 2 - In the Resource type list, select font, and then click OK. 3 - Add your font files in the font folder just by a simple copy and paste.
To change font styles in GO Launcher, copy the TTF or OTF font files on your phone. Long press on the home screen and select GO Settings > Font > Select Font. Pick the font you want or tap Scan to add files stored on your device. This won't be a system-wide change but will include the menus and app icons.
I figured it out by my self. This is the code I used. I create custom TextView
which has custom font as default font.
public class MyTextView extends TextView { public MyTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public MyTextView(Context context) { super(context); init(); } private void init() { Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "font/chiller.ttf"); setTypeface(tf ,1); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With