Font is used to give the design to TextView. If you want to use font in android then First create a Assests Folder in Your project then add the font files in Assests folder.And Make a java file for using font.See example below for more details.

First create a Java File: –

If you use font in text view then make a java class for TextView and  If you use font in EditText then make a java class for EditText and Same for Others.

Java Class for TextView: – TextBoldFont.Java

package com.jeevan.karan.sFont;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
public class TextBoldFont extends TextView {
public TextBoldFont(Context context, AttributeSet attrs) {
super(context, attrs);
this.setTypeface(Typeface.createFromAsset(context.getAssets(),   "OpenSans_ExtraBold.ttf"));
}
}

Java Class for EditText: – EditTextFont.Java

package com.jeevan.karan.sFont;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;
import android.widget.TextView;
public class EditTextFont extends EditText {
public EditTextFont(Context context, AttributeSet attrs) {
super(context, attrs);
this.setTypeface(Typeface.createFromAsset(context.getAssets(), "OpenSans_Regular.ttf"));
}
}

 

How to use in TextView: –

<com.jeevan.karan.sFont.TextBoldFont
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="The "
android:textColor="@color/white"
android:textSize="14dp"
/>