change text color of MenuItem

  1. get MenuItem out from your Controller, like:
MenuItem item = navigationView.getMenu().getItem(4);
or
MenuItem item = navigationView.getMenu().findItem(R.id.title);
  1. use SpannableString replace the origin text
SpannableString s = new SpannableString("My red MenuItem");s.setSpan(new ForegroundColorSpan(Color.RED), 0, s.length(), 0);
item.setTitle(s);

你可能感兴趣的:(change text color of MenuItem)