By default, Android consists only three fonts namely monospace, serif and sans serif. You can change the font in XML by using android:typeface=”” but unfortunately you can’t add custom font this way.
To add your custom font in your Android project, you first need to create ‘assets’ folder in your project. To create, just use the file explorer of your PC and navigate to Android project folder and then create a folder named assets inside project folder>app>src>main.
Also, create a new folder named ‘fonts’ inside your assets folder. Copy paste your font file into the fonts folder. Now, open your project in Android Studio and add the code as given below.
public class MainActivity extends AppCompatActivity
protected void onCreate(Bundle savedInstanceState)
TextView textview = (TextView)findViewById(R.id.textview);
//Replace Roboto-Regular.ttf with your font file name
Typeface customfont = Typeface.createFromAsset(getAssets(),"fonts/Roboto-Regular.ttf");
The font change may not reflect on your Android Studio preview, hence make sure the font is changed by running the app on any device or emulator.