我试图将字体应用于textviews和editTexts,但字体无声地失败,日志中没有错误或异常。字体没有变化,显示了android默认字体。
我已经尝试了大约10种字体无效(otf& ttf)都没有效果
我还尝试将其转换为http://www.freefontconverter.com/,因为有些答案可以提供。但是,仍然没有工作。
typefaceLight = Typeface.createFromAsset(getAssets(), "fonts/MyriadProRegular.otf");
// typefaceBold = Typeface.createFromAsset(getAssets(), "fonts/HNBold.otf");
// typefaceBold = Typeface.createFromAsset(getAssets(), "fonts/Helvetica.ttf");
typefaceBold = Typeface.createFromAsset(getAssets(), "fonts/HelveticaBold.ttf");
typefaceLight = Typeface.createFromAsset(getAssets(), "fonts/HelveticaLight.ttf");
typefaceArialBold = Typeface.createFromAsset(getAssets(), "fonts/helveticabold1.ttf");
// typefaceLight = Typeface.createFromAsset(getAssets(), "fonts/HNLight.otf");
registerTitleTv.setTypeface(typefaceBold);
signInTittleTv.setTypeface(typefaceBold);
termsSiginTextView.setTypeface(typefaceLight);
termsSignUpTextview.setTypeface(typefaceLight)
我已提到
Custom Fonts not working in lollipop?
Custom Font not working on Android
Changing the android typeface doesn't work
https://code.google.com/p/android/issues/detail?id=61771
Android 5.0 (API 21) fails to render custom fonts / typefaces
我的代码有问题吗?
答案 0 :(得分:0)
你的代码似乎很好。我建议您清理代码或卸载应用程序并重新安装。