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?
Aryan Kumar
27-Jun-2023Sure, here are the steps on how to control views inside navigation view header in Android:
getHeaderView()
method.setXXX()
methods to set the properties of the view.setText()
method.Here is an example of how to control views inside navigation view header in Android:
Code snippet
In this example, we get the navigation view header and the text view from the header. Then, we set the text of the text view to "Hello, world!".
Anonymous User
12-Jan-2016