android - How to change the Typeface of the Title/Subtitle of an Actionbar? -
i want customize typeface of title , subtitle of actionbar. placed desired ttf-file in asset folder , loaded typeface saying
typeface font = typeface.createfromasset(getassets(), "ardestine.ttf");
it's easy apply typeface views button
or textview
etc., how can apply actionbar
, cannot find setter-method? or have use getactionbar().setcustomview(view)
in order achieve this?
you can create spannablestring in desired typeface , set string title of actionbar.
string name = "....."; // string here spannablestring s = new spannablestring(name); s.setspan(new typefacespan(getapplicationcontext(),bold_font_filename, getresources().getcolor(r.color.white), getresources().getdimension(r.dimen.size16)), 0, s.length(), spannable.span_exclusive_exclusive); actionbar.settitle(s);
Comments
Post a Comment