Android - Using Custom Font

后端 未结 21 1680
别跟我提以往
别跟我提以往 2020-11-22 04:38

I applied a custom font to a TextView, but it doesn\'t seems to change the typeface.

Here is my code:

    Typeface myTypeface = Typeface         


        
21条回答
  •  难免孤独
    2020-11-22 05:10

    Well, after seven years you can change whole app textView or what you want easily by using android.support libraries 26++.

    E.g:

    Create your font package app/src/res/font and move your font into it.

    And in your app theme just add it as a fontFamily:

        
    

    Example for use with textView only:

    
    

    And add into your main theme:

    @style/fontTextView
    

    Currently it's worked on 8.1 until 4.1 API Jelly Bean And that's a wide range.

提交回复
热议问题