Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <item name="fontFamily">@font/avalon</item>
- 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();
- }
- private void init() {
- if (!isInEditMode()) {
- Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/custom.ttf");
- setTypeface(tf);
- }
- }
- Typeface typeface=Typeface.createFromAsset(getAssets(), "fonts/custom.ttf");
- myTextView.setTypeface(typeface);
Add Comment
Please, Sign In to add comment