for custom fonts is it necessary to add ActionBarActivity for Typeface?

66 Views Asked by At

I was reading about Custom Fonts in Android, But i have Confusion that for using Typeface(for getting your custom font from assets) is it possible to add any other activity type than ActionBarActivity().

someone please clarify my doubt.

1

There are 1 best solutions below

0
Charuක On BEST ANSWER

No, There is no relationship your tutorial just demoed it under an activity which extends ActionBarActivity.

enter image description here enter image description here

Right click on that > new Directory name it as fonts > copy your fonts to that

Then if you have a TextView that you need to apply your font

TextView myTextView=(TextView)findViewById(R.id.text_view);
Typeface typeFace=Typeface.createFromAsset(getApplicationContext().getAssets(),"fonts/your_cutom_font_name.ttf");
myTextView.setTypeface(typeFace);