While I was researching, I found an excellent solution to setting a custom font in the ActionBar title font using TypefaceSpan
. It is in fact, the second and most voted answer here. The code would look something like:
SpannableString s = new SpannableString("My Title");
s.setSpan(new TypefaceSpan(this, "MyTypeface.otf"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
// Update the action bar title with the TypefaceSpan instance
ActionBar actionBar = getActionBar();
actionBar.setTitle(s);
Looks good, but supposedly, the constructor of TypefaceSpan
used in the example no longer exisits, checking this, the only two constructors are:
public TypefaceSpan(String family)
and
public TypefaceSpan(Parcel src)
Can I still use the new constructors to set ActionBar title fonts with the new constructors? Or do I have to move on to a new method?