Android Open Source - advanced-textview Custom Font Activity






From Project

Back to project page advanced-textview.

License

The source code is released under:

Apache License

If you think the Android project advanced-textview listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sqisland.android.advanced_textview;
//from www  .  ja v a2 s  .  c  om
import android.app.Activity;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;
import android.view.View;
import android.util.AttributeSet;

public class CustomFontActivity extends Activity {

  private Typeface typeface;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    typeface = Typeface.createFromAsset(getAssets(), "Ruthie.ttf");
    setContentView(R.layout.activity_custom_font);
  }

  @Override
  public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
    //this would apply to all textviews in the app
    if (name.equals("TextView")) {
      TextView view = new TextView(this, attrs);
      view.setTypeface(typeface);
      return view;
    }

    return super.onCreateView(parent, name, context, attrs);
  }

  @Override
  public View onCreateView(String name, Context context, AttributeSet attrs) {
    //this would apply to all textviews in the app
    if (name.equals("TextView")) {
      TextView view = new TextView(this, attrs);
      view.setTypeface(typeface);
      return view;
    }

    return super.onCreateView(name, context, attrs);
  }

}




Java Source Code List

com.sqisland.android.advanced_textview.AboutActivity.java
com.sqisland.android.advanced_textview.AlignmentSpanActivity.java
com.sqisland.android.advanced_textview.AnimatedCompoundDrawableActivity.java
com.sqisland.android.advanced_textview.AnimatedRainbowSpanActivity.java
com.sqisland.android.advanced_textview.ClickableSpanActivity.java
com.sqisland.android.advanced_textview.CustomFontActivity.java
com.sqisland.android.advanced_textview.EmojiActivity.java
com.sqisland.android.advanced_textview.FractionActivity.java
com.sqisland.android.advanced_textview.FromHtmlActivity.java
com.sqisland.android.advanced_textview.GradientTextActivity.java
com.sqisland.android.advanced_textview.LinedPaperActivity.java
com.sqisland.android.advanced_textview.MainActivity.java
com.sqisland.android.advanced_textview.PatternedTextActivity.java
com.sqisland.android.advanced_textview.RainbowSpanActivity.java
com.sqisland.android.advanced_textview.ShadowTextActivity.java
com.sqisland.android.advanced_textview.StyledStringActivity.java
com.sqisland.android.advanced_textview.widget.LinedEditText.java