I\'m trying to use a custom font on a TextView. The TextView text is set with textView1.setText(Html.fromHtml(htmlText));
The
The best way right now for API 16+ is to define a font resource file if you are using Support Library above v26 or the new AndroidX libraries, basically you add your normal and italic ttf font files in the fonts folder and create a font resource xml and basically make it look something like
the last one is for bold fonts, apply this xml suppose custom_font_family.xml to your textview as android:fontFamily="@font/custom_font_family", now any html text you set with fromHtml with any of the three span types will use the proper fonts, when needed, this allows you to even have a custom font family mixing entirely different fonts and doesn't quite literally have to be from the same family.