set Font for TextView - Android android.widget

Android examples for android.widget:TextView

Description

set Font for TextView

Demo Code

import android.graphics.Typeface;
import android.widget.TextView;

public class Main {

  public static void setFont(TextView t, String font) {
    Typeface type = Typeface.createFromAsset(t.getContext().getAssets(), font);
    t.setTypeface(type);/*  w ww .  j a  v  a 2 s . c  o m*/
  }

}

Related Tutorials