Custom Fonts not working in lollipop?

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.


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

http://www.freefontconverter.com/


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