Skip to content

Instantly share code, notes, and snippets.

@dohaivu
Created July 12, 2017 07:49
Show Gist options
  • Save dohaivu/cb2bc7675864b105194849faa89d583d to your computer and use it in GitHub Desktop.
Save dohaivu/cb2bc7675864b105194849faa89d583d to your computer and use it in GitHub Desktop.
[typeface in android] custom font on #android
public void showPopup(View v) {
PopupMenu popupMenu = new PopupMenu(this, v);
popupMenu.inflate(R.menu.menu_user_profile);
for (int i = 0; i < popupMenu.getMenu().size(); i++) {
MenuItem item = popupMenu.getMenu().getItem(i);
Typeface robotoRegular = HeloTypefaceManager.TypefaceWithFontName(this, HeloTypefaceManager.ROBOTO_REGULAR);
SpannableString title = new SpannableString(item.getTitle());
title.setSpan(new CustomTypefaceSpan("", robotoRegular), 0, title.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
item.setTitle(title);
}
popupMenu.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment