Create one Class and name it whatever you want, that class will extend TextView, and that class will load the font. And further you can use that font in your xml itself.
Like this:
public class CustomEditTextGEFlowBook extends android.support.v7.widget.AppCompatEditText {
public CustomEditTextGEFlowBook(Context context) {
super(context);if(!isInEditMode())
setFont(context);
}
public CustomEditTextGEFlowBook(Context context, AttributeSet attrs) {
super(context, attrs);if(!isInEditMode())
setFont(context);
}
public CustomEditTextGEFlowBook(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);if(!isInEditMode())
setFont(context);
}
private void setFont(Context context) {
Typeface font = Typeface.createFromAsset(getContext().getAssets(),
"GOTHAM-BOOK.OTF");
setTypeface(font);
}
}
Now from your xml, use your TextView or EditText like this.
.
<com.packageName.CustomEditTextGEFlowBook
android:id="@+id/radioOthers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="Mention the Issue"
android:maxLength="50" />