Попробуйте ниже Soultion
Решение 1
Добавьте свой шрифт в assets папок, как показано ниже изображение
И используйте приведенный ниже метод для установки шрифта typeFace
CommonUtils.setFont(context, binding.txtDigital, "Montserrat-Bold.ttf");
public static void setFont(Context context, TextView textView, String fontPath) {
Typeface t = Typeface.createFromAsset(context.getResources().getAssets(), fontPath);
textView.setTypeface(t);
}
Solution 2
Добавьте папку шрифтов внутри res папка, как показано на рисунке ниже
И непосредственно добавьте семейство шрифтов в текстовое представление
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/app_name"
android:fontFamily="@font/roboto_medium"
android:textColor="@color/black"
android:textSize="@dimen/_20ssp"
android:visibility="gone" />
Надеюсь, это тебе поможет!
Спасибо.