Back to project page Android-TextFontStyle.
The source code is released under:
Apache License
If you think the Android project Android-TextFontStyle listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.raychenon; // ww w.j a v a 2 s .c om import android.content.Context; import android.content.res.TypedArray; import android.graphics.Typeface; import android.util.AttributeSet; import android.widget.TextView; /** * User: raychenon * Date: 15/7/13 * Time: 9:00 PM */ public class TextViewStyle extends TextView { public TextViewStyle(Context context) { super(context); } public TextViewStyle(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.com_textfontstyle_fontstyle); CharSequence s = a.getString(R.styleable.com_textfontstyle_fontstyle_typeFace); if (s != null) { Typeface typeface = Typeface.createFromAsset(context.getAssets(), s.toString()); this.setTypeface(typeface); } a.recycle(); } public TextViewStyle(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } }