![]() ![]() This is important as some of the features are not supported on Android Studio 2.x – for example the font resource directory. To work with custom fonts you’ll first have to install the latest Android Studio 3.x. ![]() Not to mention that it felt wrong extending a TextView just for setting a custom font. In some cases things could get messy – for example if you had to change the font on Toolbar.On some devices loading from assets could take a long time so you had to cache fonts in memory.You had to extend every type of View you wanted to apply a custom font to.That was a little bit better but there were still issues: To remedy that you could extend your view classes and add a custom attribute for passing the font file from layout. ![]() Val myTypeface = Typeface.createFromAsset(assets, "fonts/myFont.ttf") ![]() The main disadvantage in this approach was that you couldn’t set the font in layout files – you had to do it in code:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |