How to control views inside NavigationView Header in Android

Total Post:45

Points:315
 789  View(s)
Ratings:
Rate this:
I want to implement  if there is any way to control views inside the NavigationView header? (Except for adding or removing header.)

For example: In the header, I have a user avatar. By default, it displays a guest image, but after the user logs in, the real avatar will be showed.

How can this be accomplished?
  1. Post:397

    Points:3117
    Re: How to control views inside NavigationView Header in Android

    After the new support library update (23.1.1),

    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()


      Modified On Apr-10-2018 11:39:22 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!