How to access Button inside “include” layout

后端 未结 5 1709
不知归路
不知归路 2020-12-13 12:36

Refer to the doc: http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html

I have a button inside the included layout, how can I a

5条回答
  •  天命终不由人
    2020-12-13 13:13

    i think your mean is NavigationView. you can access to inner layout by this way:

    NavigationView ngv= (NavigationView) findViewById(R.id.navigation_id);
    View innerview =  ngv.getHeaderView(0);
    TextView user_view= (TextView)innerview.findViewById(R.id.nav_name); //any you need
    user_view.setText(user);
    

提交回复
热议问题