0

im trying to add a custom font in my project, I saw severals tutorials, and in all of them they add the fon programaticly like the following:

Typeface myTypeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/COOPPBL.TTF");
    TextView tv = (TextView) view.findViewById(R.id.textview1);
    tv.setTypeface(myTypeface);

Coukld someone tell me if there a way to add the font in the XML and not using java, thanks a lot.

  • http://stackoverflow.com/questions/2376250/custom-fonts-and-xml-layouts-android – Krish Apr 06 '17 at 15:42
  • 1
    Possible duplicate of [Custom fonts and XML layouts (Android)](http://stackoverflow.com/questions/2376250/custom-fonts-and-xml-layouts-android) – Submersed Apr 06 '17 at 15:43
  • In android O, there should be way to do that. Until then only java – X3Btel Apr 06 '17 at 15:44
  • Possible duplicate of http://stackoverflow.com/questions/9477336/how-to-make-a-custom-textview – AlexTa Apr 06 '17 at 15:44

1 Answers1

0

You unfortunately cannot. You can do that programmatically only, as android does not have built-in support for that through XML.