Custom Fonts not working in lollipop?

前端 未结 3 1108
旧巷少年郎
旧巷少年郎 2020-12-03 05:48

I have developed a handwriting app .And one of the main feature of this is that we can change the fonts from default font to 4 other custom fonts ie, to

Vicm         


        
3条回答
  •  伪装坚强ぢ
    2020-12-03 06:25

    Error on lollipoop

    test files .otf run correctly but .ttf not. my solution for files .ttf was convert to .otf

    http://www.files-conversion.com/font-converter.php

    or

    http://www.font2web.com/

    for custom font for example, inside assets folder (../assets/fonts/birdman-webfont.otf):

    Typeface birdman = Typeface.createFromAsset(getAssets(), "fonts/birdman-webfont.ttf");
    TextView text= (TextView) findViewById(R.id.text);
    text.setTypeface(birdman);
    

    note: if your file is .ttf and show ERROR in the convertion, change the extension to .otf manually and convert with http://www.files-conversion.com/font-converter.php

提交回复
热议问题