HOW TO CONTROL VIEWS INSIDE NAVIGATIONVIEW HEADER IN ANDROID

Sanjay Sharma

Total Post:45

Points:315
Posted by  Sanjay Sharma
 499  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. Mayank Tripathi

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


Answer

NEWSLETTER

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