Android - Using Custom Font

后端 未结 21 2010
别跟我提以往
别跟我提以往 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:25

    Yes, downloadable fonts are so easy, as Dipali s said.

    This is how you do it...

    1. Place a TextView.
    2. In the properties pane, select the fontFamily dropdown. If it isn't there, find the caret thingy (the > and click on it to expand textAppearance) under the.
    3. Expand the font-family drop down.
    4. In the little list, scroll all the way down till you see more fonts
    5. This will open up a dialog box where you can search from Google Fonts
    6. Search for the font you like with the search bar at the top
    7. Select your font.
    8. Select the style of the font you like (i.e. bold, normal, italic, etc)
    9. In the right pane, choose the radio button that says Add font to project
    10. Click okay. Now your TextView has the font you like!

    BONUS: If you would like to style EVERYTHING with text in your application with chosen font, just add @font/fontnamehere into your styles.xml

提交回复
热议问题