set TypeFace to View - Android User Interface

Android examples for User Interface:View Property

Description

set TypeFace to View

Demo Code


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

public class Main {
    private static boolean DO_SUBPIXEL_RENDERING = true;

    public static void setTypeFace(Typeface typeFace, TextView... views) {
        for (TextView view : views) {
            view.setTypeface(typeFace);/*from   www  .j a  v  a  2 s .  co  m*/
            if (DO_SUBPIXEL_RENDERING) {
                System.out.println("do subpixel rendering");
                view.setPaintFlags(view.getPaintFlags()
                        | Paint.SUBPIXEL_TEXT_FLAG);
            }
        }
    }
}

Related Tutorials