LayoutInflater inflater = (LayoutInflater)this.getSystemService(this.LAYOUT_INFLATER_SERVICE);
View nav_header_view = inflater.inflate(R.layout.nav_header_main, null);
app = (MyApplication) getApplication();
TextView tvUserName = (TextView)nav_header_view.findViewById(R.id.userName);
String userName = app.getUserName();
tvUserName.setText(userName);
TextView tvUserEmail = (TextView)nav_header_view.findViewById(R.id.userEmail);
String userEmail = app.getUserId();
tvUserEmail.setText(userEmail);
这里修改的是当前Activity对应xml下的一个子xml,就是导航菜单的头部信息
![图片说明](https://img-ask.csdn.net/upload/201612/19/1482121367_532086.png)
![图片说明](https://img-ask.csdn.net/upload/201612/19/1482121250_2046.png)