I know to set Typeface from coding like below.
type1=Typeface.createFromAsset(getAssets(),"fonts/helveticaneueLtstd-bd.otf");
text.setTpeface(type1);
But it is difficult to me to set Typeface if I have more text views. How can I set the typeface from XML instead of from coding?
In the xml layout you can only use
normal,sans,serifandmonospaceas fonts. Any other font will have to be set in code like you did.You could extend
TextView(and use that class instead of the plainTextViewin the xml layout) and implement a custom attribute that could take another font, other than the fonts I listed above.