Android - Using Custom Font

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

    • Open your project and select Project on the top left
    • app --> src --> main
    • right click to main and create directory name it as assets
    • right click to assest and create new directory name it fonts
    • you need to find free fonts like free fonts
    • give it to your Textview and call it in your Activity class
    • copy your fonts inside the fonts folder
    • TextView txt = (TextView) findViewById(R.id.txt_act_spalsh_welcome); Typeface font = Typeface.createFromAsset(getAssets(), "fonts/Aramis Italic.ttf"); txt.setTypeface(font);

    name of the font must be correct and have fun

提交回复
热议问题