Custom Fonts not working in lollipop?

前端 未结 3 1102
旧巷少年郎
旧巷少年郎 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

    0 讨论(0)
  • 2020-12-03 06:27

    re-convert your whatever fonts to .ttf from this link works for me.

    http://www.freefontconverter.com/

    0 讨论(0)
  • 2020-12-03 06:41

    I did it in following way:

    I have updated TextView with androidx.appcompat.widget.AppCompatTextViewand it works for each device.

    Example

    From

     <TextView
    

    To

     <androidx.appcompat.widget.AppCompatTextView
    

    Hope it helps you.

    0 讨论(0)
提交回复
热议问题