Thursday, 2 April 2015

Add fonts to android application

Here I am going to explain how to add an external font style to android application programmatically.

Step 1).Download the font type from here.
Step 2).Create a folder "fonts" inside the "assests" folder.
Step 3).Import The jar file into the folder "fonts".

Step 4).Open the fonts.xml file and create Textview.

<?xml version="1.0" encoding="utf-8"?>

< LinearLayout xmlns:android=""
    android:background="#000000" >
        android:text="NewFont" />

Step 4)

package com.example.androidhive;
import android.os.Bundle;
import android.widget.TextView;
public class Fonts extends Activity 
TextView newFont;
    public void onCreate(Bundle savedInstanceState) {
  String Path= "";//Type your path
      Typeface T = Typeface.createFromAsset(getAssets(), Path);

Happy Coding :)....