Is there any way to change the font for a EditText in Android? I want it to match the font\'s I set for all my textViews.
use this code in your java class
EditText et_brand=(EditText)findViewById(R.id.et_brand);
et_brand.setTypeface(Typeface.createFromAsset(getAssets(),"Aspergit Bold.ttf"));
//Aspergit Bold.ttf is Font style name of text
Create a new java class and it as u want
public class CustomTextView extends TextView {
public CustomTextView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
init();
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public CustomTextView(Context context) {
super(context);
init();
}
private void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),
"Aspergit Bold.ttf");
setTypeface(tf);
}
}
Use it in your Xml file