Skip to content

Instantly share code, notes, and snippets.

@espritm
Created March 27, 2017 16:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save espritm/b0d41e5043eb1f11fd02e9a9fc927cf7 to your computer and use it in GitHub Desktop.
protected override void OnCreate(Bundle bundle)
{
//...
//Add a header view to the NavigationView
ConfigureNavigationViewHeader();
}
private void ConfigureNavigationViewHeader()
{
View viewHeader = LayoutInflater.Inflate(Resource.Layout.mainActivity_navigationView_header, null);
ImageView imageviewUserAvatar = viewHeader.FindViewById<ImageView>(Resource.Id.mainActivity_navigationView_header_imageview_userAvatar);
TextView textviewUserPseudo = viewHeader.FindViewById<TextView>(Resource.Id.mainActivity_navigationView_header_textview_UserPseudo);
TextView textviewUserDesc = viewHeader.FindViewById<TextView>(Resource.Id.mainActivity_navigationView_header_textview_UserDesc);
imageviewUserAvatar.SetImageResource(Resource.Drawable.photo_profil);
textviewUserPseudo.Text = "Maxime Esprit";
textviewUserDesc.Text = "A passionate mobile apps developer";
m_navigationView.AddHeaderView(viewHeader);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment