android - Changing menu item's text background in toolbar -


how change menu item's text background while clicking on it? higlight color on whole item right, seems text has it's own background color. think deal in settin on app:popuptheme, don't know style parameters should set.

enter image description here

kindly use , set desired color.

@override public void oncreateoptionsmenu(menu menu, menuinflater inflater) {     inflater.inflate(r.menu.your_menu, menu);      int positionofmenuitem = 0; // or whatever...     menuitem item = menu.getitem(positionofmenuitem);     spannablestring s = new spannablestring("my menuitem");     s.setspan(new foregroundcolorspan(color.red), 0, s.length(), 0);     item.settitle(s); } 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -