You could subclass EditText
and set the typeface in the constructor:
public class MyEditText extends EditText {
// replace '...' with proper arguments
public MyEditText(...) {
super(...)
// fetch your font
this.setTypeface(myFont);
}
}
Don't forget the EditText(Context context, AttributeSet attrs)
and EditText(Context context, AttributeSet attrs, int style)
constructors in your subclass or your layout will fail to inflate.
Then in your layout.xml
, refer to your new MyEditText
subclass instead:
<com.myapp.MyEditText
... />