NavigationView get/find header layout

前端 未结 7 991
感情败类
感情败类 2020-11-22 02:57

In my NavigationView I have a header layout with id \'viewId\' with active buttons. To setup those buttons, I do the following in activity\'s onPostCreate:

7条回答
  •  别那么骄傲
    2020-11-22 03:21

    NavigationView navigationView = findViewById(R.id.your_nav_view);
    View header = navigationView.getHeaderView(0);
    TextView textUsername = header.findViewById(R.id.textView);
    textUsername.setText("you text here ");
    

提交回复
热议问题