public static void applyFontToMenu(Menu m, Context mContext){
for(int i=0;i<m.size();i++) {
applyFontToMenuItem(m.getItem(i),mContext);
}
}
public static void applyFontToMenuItem(MenuItem mi, Context mContext) {
if(mi.hasSubMenu())
for(int i=0;i<mi.getSubMenu().size();i++) {
applyFontToMenuItem(mi.getSubMenu().getItem(i),mContext);
}
Typeface font = Typeface.createFromAsset(mContext.getAssets(), "fonts/yourCustomFont.ttf");
SpannableString mNewTitle = new SpannableString(mi.getTitle());
mNewTitle.setSpan(new CustomTypefaceSpan("", font, mContext), 0, mNewTitle.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
mi.setTitle(mNewTitle);
}
and then in the Activity:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
applyFontToMenu(menu,this);
return true;
}