Example usage for android.widget TextView setTypeface

List of usage examples for android.widget TextView setTypeface

Introduction

In this page you can find the example usage for android.widget TextView setTypeface.

Prototype

public void setTypeface(@Nullable Typeface tf) 

Source Link

Document

Sets the typeface and style in which the text should be displayed.

Usage

From source file:Main.java

public static void applyTypeface(TextView textView) {
    textView.setTypeface(arabicTypeFace);
}

From source file:Main.java

public static void setTextViewFont(TextView tv, Typeface tf) {
    tv.setTypeface(tf);
}

From source file:Main.java

public static void setDate(TextView dateView, Typeface font) {
    dateView.setTypeface(font);
    dateView.setText(new SimpleDateFormat("EEEE, MMMM d yyyy").format(new Date()));
}

From source file:Main.java

public static void setTitle(TextView title, Typeface font, String text) {
    title.setTypeface(font);
    title.setText(text);
}

From source file:Main.java

/**
 * Sets Roboto Light Italic font for a given text view.
 * @param textView/*from   w  ww.  j a  va  2 s.c  o m*/
 * @param assetManager
 */
public static void setRobotoLightItalic(TextView textView, AssetManager assetManager) {
    textView.setTypeface(Typeface.createFromAsset(assetManager, "font/Roboto-LightItalic.ttf"));
}

From source file:Main.java

/**
 * Sets Roboto Light font for a given text view.
 * @param textView/*w w  w. ja va  2s .  c  om*/
 * @param assetManager
 */
public static void setRobotoLight(TextView textView, AssetManager assetManager) {
    textView.setTypeface(Typeface.createFromAsset(assetManager, "font/Roboto-Light.ttf"));
}

From source file:Main.java

/**
 * Set typeface for a TextView/*  w  ww  .j a  v a 2  s  .  c o  m*/
 *
 * @param typeFace
 * @param view
 */
public static void setTypeFace(Typeface typeFace, TextView view) {
    view.setTypeface(typeFace);
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}

From source file:Main.java

public static void setTextViewTypeface(TextView textView) {
    String font = "LockScreen_Clock.ttf";
    textView.setTypeface(Typeface.createFromAsset(textView.getContext().getAssets(), font));
}

From source file:Main.java

/**
 * helper method to check whether the typeface is null or not.
 *
 * @param textView/*from  www . j  a  v a 2 s  . c  o m*/
 * @param typeface
 */
public static void setTypeface(TextView textView, Typeface typeface) {
    if (typeface != null) {
        textView.setTypeface(typeface);
    }
}

From source file:Main.java

/**
 * Sets the font on a particular TextView
 * @param assets AssetManager/*w  w w .  ja  v  a2 s.c  o  m*/
 * @param tv TextView the text to apply the font to
 */
public static void setTitleFont(AssetManager assets, TextView tv) {
    Typeface tf = Typeface.createFromAsset(assets, TITLE_FONT);
    tv.setTypeface(tf);
}