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

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -