NavigationView get/find header layout

前端 未结 7 977
感情败类
感情败类 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:15

    Now with the 23.1.1 release of the design support library, you can use

    NavigationView navigationView = (NavigationView) findViewById(R.id.your_nav_view_id);
    View header = navigationView.getHeaderView(0)
    TextView text = (TextView) header.findViewById(R.id.textView);
    

提交回复
热议问题