1) (yourfont.ttf)
2) /
Typeface yourfont = Typeface.createFromAsset(getAssets(),
"fonts/yourfont.ttf");
3) TextView ( , ) setTypeface .
.
TextView textview1 = (TextView) findViewById(R.id.exampletextview);
textview1.setTypeface(yourfont);
, , , , , , Typeface . , Textview. - :
public class MyTextView extends TextView {
public MyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MyTextView(Context context) {
super(context);
init();
}
public void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/yourfont.ttf");
setTypeface(tf ,1);
}
}
xml <com.yourpackagename.MyTextView />