有
我面临的问题,改变工具栏/操作栏的溢出菜单项的文字颜色。我做了太多的google搜索和阅读#1的答案,但它不能解决我的prblem
I facing problem to change the text colour of toolbar/action bar overflow menu item. I do too many googling and reading Stackoverflow answers but it can not solve my prblem
currenlt我得到的黑色到溢出菜单项。
currenlt i am getting black colour into overflow menu item.
我想是 1.我想更改菜单项的黑到白的颜色。 2.我想改变溢出菜单的宽度相匹配父画面
what i want is 1. I want to change the colour of menu item black to WHITE. 2. I want to change the width of the overflow menu to match parent screen
我的code:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="android:textColorPrimary">@color/primary_text</item>
<item name="android:textColorSecondary">@color/secondary_text</item>
<item name="android:divider">@color/divider</item>
<item name="icon">@color/icons</item>
<item name="actionOverflowMenuStyle">@style/AppTheme.Base.PopupMenu</item>
</style>
<style name="AppTheme.Base.PopupMenu" parent="android:Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">@color/primary</item>
</style>
请,帮我解决这个问题。
Please, help me to solve this..
在此先感谢
我终于得到了code为转换黑色到白色
finally i got the code for the convert black colour to white
public boolean onPrepareOptionsMenu(Menu menu) {
//return super.onPrepareOptionsMenu(menu);
try {
for (int i = 0; i < menu.size(); i++) {
MenuItem mi = menu.getItem(i);
mi.setIcon(R.drawable.ic_action_new);
String title = mi.getTitle().toString();
Spannable spannable = new SpannableString(title);
spannable.setSpan(new ForegroundColorSpan(Color.WHITE), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mi.setTitle(spannable);
}
} catch (Exception ex) {
}
return true;
}