我用以下代码编程实现了这一点:
打电话之前先把这个放好
popup.show()
// Change PopupMenu subMenu title color
PopupMenu popup = new PopupMenu(activity, view);
Menu itemSetAs = popup.getMenu();
SubMenu s = itemSetAs.findItem(R.id.SetAs).getSubMenu();
SpannableString headerTitle = new SpannableString(itemSetAs.findItem(R.id.SetAs).getTitle());
// Change the color:
headerTitle.setSpan(new ForegroundColorSpan(Color.YOUR_COLOR), 0, headerTitle.length(), 0);
// You can even change the size:
int textSize = getResources().getDimensionPixelSize(R.dimen.your_size);
headerTitle.setSpan(new AbsoluteSizeSpan(textSize), 0, headerTitle.length(), SPAN_INCLUSIVE_INCLUSIVE);
s.setHeaderTitle(headerTitle);
popup.show().