I am trying to implement a custom typeface on an EditText
. Does anyone have a better approach as opposed to what I'm currently doing?
Typeface myFont = Typeface.createFromAsset(getAssets(), "fonts/myfont.ttf");
edittext.setTypeface(myFont);
Because I have lots of EditText
s...
try this one
You need to make one method in Common class Like,
Now call this method as
And use in your activity like this FontLoader.setQuickSandTypeface(YourEditText) in your activity
Create a new class that extends
EditText
likeand include it on your XML like
Try this. Also useful for Buttons, TextViews.. whatever!
Who is possible? By this way!
In addition, a
font_attrs.xml
in yourres
folder:How about create a new class that inherits EditText and sets the typeface you want and then instantiate the new class in the xml?