Custom text view set font
* first of all assest folder paste font
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
public class TextViewNormal extends TextView {
public TextViewNormal(Context context) {
super(context);
init();
/* Typeface face=Typeface.createFromAsset(context.getAssets(), "helvetica_neue_lt_pro.otf"); this.setTypeface(face);*/ }
public TextViewNormal(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public TextViewNormal(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init() {
Typeface face=Typeface.createFromAsset(getContext().getAssets(), "helvetica_neue_lt_pro.otf");
this.setTypeface(face);
}
}
______________________________________________________________________
<com.view.TextViewNormal
android:layout_width="wrap_content" android:layout_height="wrap_content" />
No comments:
Post a Comment