apply Font to TextView from Path - Android User Interface

Android examples for User Interface:TextView

Description

apply Font to TextView from Path

Demo Code


//package com.java2s;
import android.content.Context;
import android.graphics.Typeface;
import android.widget.TextView;

public class Main {
    public static void applyFont(Context context, TextView view, String path) {
        Typeface customFont = Typeface.createFromAsset(context.getAssets(),
                path);/*from w  w  w .  j a v  a2 s  . co m*/
        view.setTypeface(customFont);
    }
}

Related Tutorials