Поместите файл шрифта otf в / assets / fonts, создайте утилиты для работы со шрифтами, такие как:
public class TypefaceUtils {
private static Typeface myFont1;
private static Typeface myFont2;
public static Typeface getMyFont1() {
return myFont1;
}
public static Typeface getMyFont2() {
return myFont2;
}
public static void initTypeface(Context context) {
if (context != null) {
myFont1 = Typeface.createFromAsset(context.getAssets(), "fonts/myfont1.otf");
myFont2 = Typeface.createFromAsset(context.getAssets(), "fonts/myfont2.otf");
}
}
}
Начальные шрифты при включении Создайте свою основную активность
TypefaceUtils.initTypeface(this);
Установите шрифт, где вам нужно, например:
textView.setTypeface(TypefaceUtils.getMyFont1());