Is there any way to control views inside NavigationView header?

后端 未结 4 2263
我在风中等你
我在风中等你 2020-12-03 03:07

As the title says, I want to know if there is any way to control views inside the NavigationView header? (Except for adding or removing header.)

For exa

4条回答
  •  攒了一身酷
    2020-12-03 03:40

    After updating your support library to version 23.1.1 or above,

    You could do this -

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

    or if you have multiple headers

    navigationView.getHeaderCount()
    

    Ref : https://code.google.com/p/android/issues/detail?id=190226#c31

提交回复
热议问题