I want to change a custom font to my action bar title, have gone through couple of accepted answers,but no luck,I have tried as below,But my custom font is not applied to my actionbar title,Please help me to get rid of this,my code is as below:
java
Typeface font = Typeface.createFromAsset(getActivity().getAssets(),
"neuropolx.ttf");
SpannableString s = new SpannableString(
" KOLAY RANDEVU");
s.setSpan(new CustomTypefaceSpan("", font), 0, 4,
Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
getActivity().getActionBar().setTitle(s);
You can solve this problem by using this code
Changing Actionbar title font is not completely supported, but you can use a custom view for your action bar. Use custom view and disable native title. It will display between icon and action items. You can inherit all activities from a single activity, which has this code in onCreate:
and your layout xml (R.layout.customTitleView in the code above) looks like this:
use
in that view you can use TextView for which you can set Font of your choice
you can make your own custom action bar and then change the title font. and you can put your font file in assets folder and access from it. Try like this:
and it's xml file will be like this:
Hope it helps...