How to change a textview in NavigationView app:headerLayout xamarin android?

EnglbachEnglbach VNMember ✭✭
edited May 2016 in Xamarin.Android

< android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/nav_view"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/navmenu" />
drawer_header

< RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="120dp"
android:background="#FFFFFF">

< FFImageLoading.Views.ImageViewAsync
android:id="@+id/imgThunbailUser"
android:layout_width="80dp"
android:layout_height="80dp" />
< TextView
android:id="@+id/txtUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:textColor="#ffffff"
android:text="Music store"
android:textSize="18dp" />
< TextView
android:id="@+id/txtlast_modified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:layout_marginLeft="16dp"
android:layout_marginTop="5dp"
android:text="SoundCloud"
android:textSize="14dp"
android:textStyle="normal" />
< /LinearLayout>
< /RelativeLayout>
MainActivity

txtUsername = FindViewById (Resource.Id.txtUsername);
textUsername.text="bcdf";
I have tried it but I got error at textUsername. I'm making a login. I need load a image, textview to drawer_header.

Best Answer

Answers

  • hoitmhoitm USMember ✭✭

    var navigationView = FindViewById(Resource.Id.nav_view);
    var headerView = navigationView.GetHeaderView(0)
    _var txtUsername = x.FindViewById(Resource.Id.txtUsername);
    _

    'X' where is this

  • SeanRedburnSeanRedburn USMember

    var navigationView = FindViewById(Resource.Id.nav_view);
    var headerView = navigationView.GetHeaderView(0)
    _var txtUsername = headerView.FindViewById(Resource.Id.txtUsername);

Sign In or Register to comment.