我在Android Studio中看到了很多有关TrueType字体的参考资料,但没有一篇描述如何使用OpenType字体的。是否有办法在Android Studio项目中也使用OpenType字体?
我在Android Studio中看到了很多有关TrueType字体的参考资料,但没有一篇描述如何使用OpenType字体的。是否有办法在Android Studio项目中也使用OpenType字体?
TTF一直得到支持,OTF至少在1.6及以后版本才被添加,但只是部分支持。
Typeface face;
face = Typeface.createFromAsset(getAssets(), "font.otf");
textview.setTypeface(face);
有用的链接: 在Android中使用外部字体
你可以转换这个页面: http://www.ehow.com/how_6192479_convert-dfont-ttf.html,https://onlinefontconverter.com/
TextView usernamesigin = (TextView)findViewById(R.id.username_signin_edittxt);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/MyriadPro-Regular.otf");
usernamesigin.setTypeface(tf);
context.getAssets()
。 - Bheid