答案 0 :(得分:1)
在navigationDrawer
styles.xml
标题创建样式
<style name="HeaderTextAppreance">
<item name="android:textColor">@color/colorPrimary</item>
</style>
然后在您的活动中使用它的ID访问您的navigation header
,然后尝试:
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
Menu menu = navigationView.getMenu();
MenuItem tools= menu.findItem(R.id.yourId);
SpannableString s = new SpannableString(tools.getTitle());
s.setSpan(new TextAppearanceSpan(this, R.style.HeaderTextAppreance), 0, s.length(), 0);
tools.setTitle(s);
navigationView.setNavigationItemSelectedListener(this);