答案 0 :(得分:0)
要访问Navigation Header中的视图,您必须先获取HeaderView。
NavigationView navigationView = (NavigationView) findViewById(R.id.navViewID);
navigationView.setNavigationItemSelectedListener(this);
View header=navigationView.getHeaderView(0);
userName = (TextView)header.findViewById(R.id.userTextViewID);
userName.setText("Your user Name from Firebase");