Custom font not working in lollipop

。_饼干妹妹 提交于 2019-11-29 07:59:42

I use this Library and it works superbly on all devices

Step:-

1) Add this line in your gradle compile 'com.github.balrampandey19:FontOnText:0.0.1'

2) Add your font in asset folder like this

3) Then replace your view in xml with

<com.balram.library.FotTextView
                    android:id="@+id/vno_tv"
                    .
                    .
                    android:textSize="14sp"
                    app:font="regular.ttf" />

this line is important to set custom font you want app:font="regular.ttf"

You can do same for Buttons Edittext

OR

If you want to use same "Font" through whole application you can follow this Guide here

  1. The root cause of the problem is badly written font files, so it makes sense that the solution is to re-encode the offending font. You can use a online converting tool such as http://www.freefontconverter.com/.

  2. Another Alternative is using a library for custom fonts like https://github.com/chrisjenx/Calligraphy

dependencies {
            compile 'uk.co.chrisjenx:calligraphy:2.2.0'
        }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!