Set Custom Fonts for TextView and EditText in Android

Custom Fonts

Anu S Pillai

The Admin at GadgetSaint.com

You may also like...

13 Responses

  1. Gigibit says:

    Error:(64) No resource identifier found for attribute ‘customFont’ in package ‘com.archimedia.moveng’

  2. Gigibit says:

    Sorry, just delete previous comment.

    What does ‘foo:’ mean?

  3. Anu S Pillai says:

    That is just a namespace. You may write your own.

  4. Anu S Pillai says:

    Check the linearlayout code.. foo is defined there

  5. Gigibit says:

    Thanks a lot!

    Anyway there is an error in here:

    typeface = Typeface.createFromAsset(ctx.getAssets(), asset);

    In your example you said:
    “Once the Assets folder is created, create a subfolder inside assets folder called fonts.”

    So that line should be:

    typeface = Typeface.createFromAsset(ctx.getAssets(), “fonts/”+asset);

    Doesn’t matter, thanks a lot!

  6. Anu S Pillai says:

    Thanks for pointing out, I will make the change! 🙂

  7. DOA says:

    worked like a charm, great guide.

  8. Gungde says:

    Is it work to Edittext if we do like the same?

  9. Anu S Pillai says:

    Yes it will work

  10. test says:

    not working this code

  1. August 5, 2018

    […] font, lets create a custom class to set our fonts from here on using that. Check this article from gadgetsaint which explains the method we are going to be using. We are looking at Method 2 from that, and […]

  2. December 1, 2018

    […] Marque esta tut gadgetsaint.com/android/custom-fonts-textview-edittext-android/… […]

Leave a Reply

Your email address will not be published.