# Android Custom font styles
The Custom font settings in Android are generally set through the facetype attribute. First, let's take a look at the methods provided on the official website.
As the name implies, we can set the font by using the asset file under the assets file in the project or the system file of android.
To use the assets method, first create the assets folder in the project path,
After setting the file, you can use
Typeface typeface1 = Typeface.createFromAsset(this.getAssets(),"fonts/1.TTF"); tvText1.setTypeface(typeface1);
Method or a subclass of TextView
public class MyTextView extends TextView {public MyTextView(Context context) { super(context);}public MyTextView(Context context, AttributeSet attrs) { super(context, attrs);}public MyTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr);}@Overridepublic void setTypeface(Typeface tf, int style) { super.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "2.tff"));}
}
If a system file is used, you must note that the path setting must start with "system" When referencing it.
Typeface tf = Typeface.createFromFile("/system/fonts/AndroidClock.ttf")
You can use these methods to customize TextView text styles.