I want to change my android app font to custom font and change font size. include all of activities and objects and alert dialog. How to do this?
Asked
Active
Viewed 80 times
3 Answers
0
figured it out by my self. This is the code I used. I create custom TextView which has custom font as default font. use Custom Textview to your Andrid Application
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();
}
public void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "font/chiller.ttf");
setTypeface(tf ,1);
}
}

Community
- 1
- 1

Naveen Tamrakar
- 3,349
- 1
- 19
- 28
-
I would suggest you cache the initialized typeface as initialing from asset/resource is an expensive process. – Fabin Paul Sep 12 '15 at 13:32
0
If you want to change the font in your app then you require
- font file i.e roboto.ttf
- custom textview where the font has been applied to the text.
I would recommend this library Fontify

Fabin Paul
- 1,701
- 1
- 16
- 18
0
Just make a class that extend Application and also mention that class in the manifest of the app using name attribute in application tag.In that class onCreate use the below code.
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "Roboto-Thin.ttf");

Avinash Ranjan
- 611
- 5
- 14