Apply typeFace to all TextView - Android User Interface

Android examples for User Interface:TextView Font

Description

Apply typeFace to all TextView

Demo Code


//package com.java2s;

import android.graphics.Paint;
import android.graphics.Typeface;

import android.widget.TextView;

public class Main {
    /**//from   w  ww.j a v  a 2 s  . c o m
     * Apply typeFace to all view
     * 
     * @param pTypeFace
     *            the type face to apply
     * @param pViews
     *            all view to apply typeface
     */
    public static void setTypeFace(final Typeface pTypeFace,
            final TextView... pViews) {
        for (TextView view : pViews) {
            view.setTypeface(pTypeFace);
            view.setPaintFlags(view.getPaintFlags()
                    | Paint.SUBPIXEL_TEXT_FLAG);
        }
    }
}

Related Tutorials