这是我当前的输出
现在
我们如何更改选项菜单标题颜色?
答案 0 :(得分:1)
为菜单选项创建Actionview,您可以更改其背景
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//You can add menuitems programmatically or by inflating menu
//Here I added programatically
//Create your own menu item layout and add it to menu
MenuItem menuItem = menu.add(0, 0, 0, "");
menuItem.setActionView(R.layout.menu_item1_layout);
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
//We can get the menu item layout by below line of code
View v = menu.getItem(0).getActionView();
//You set your own color or drawable by below line of code
v.setBackgroundResource(R.drawable.your_own_drawable);
return super.onCreateOptionsMenu(menu);
}