NavigationView get/find header layout

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

    In Kotlin @Francois Dermu code be like

    val navigationView : NavigationView = findViewById(R.id.your_nav_view_id);
    val header = navigationView.getHeaderView(0)
    val textView = header.findViewById(R.id.textView)
    

提交回复
热议问题