So if you want to set an external font to a text view, you have different options:
- A common step: Get the font and put it under assets/fonts folder (create it if it not already created)
1 - Use this Gist:
Typeface typeface = Typeface.createFromAsset(getAssets(),"Roboto-Regular.ttf");2 - Use DataBinding Lib as described in here: fontbinding
TextView textview = (TextView) findViewById(R.id.textview);
textview.setTypeface(typeface);
3- Use XML attributes through custom widget: this is a good blog covering it all Custom fonts
No comments:
Post a Comment