For a Halloween mapping app I was working on recently, I wanted to change the color and typeface of items in the standard options menu.
After trying some obvious things, like experimenting with text/color/font related attributes on the ‘item’ tag and monkeying around with the app’s theme, I found that I do not know how to do this.
So, I looked at this, this, this, and this. But, I never quite managed to change both the color and the typeface on the individual menu items. (Maybe I could have created a custom class that merges the features of a ForegroundColorSpan and a TypefaceSpan and a SpannableString or something, but I ran out of patience.) It started to look like more work than I wanted to do. And I’m not a big fan of the options menu anyway.
So I gave up on the options menu and started to look for something else. Eventually, I found Nightonke’s Boom Menu. Compared to most free android libraries hosted on GitHub, Boom Menu is awesome. Changing the text color and typeface are EASY. And the documentation is solid.
It was easy to change a Boom Menu button’s text color and typeface. I read the doc pages. Then I was like, Boom:
TextInsideCircleButton.Builder builder = new TextInsideCircleButton.Builder(); builder.typeface(ResourcesCompat.getFont(this, R.font.my_custom_font)); builder.normalTextColor(R.color.colorAccent);
Thank you, Nightonke!