У меня есть 2 Layout и navmenu XML файл. Я вхожу в систему с именем пользователя и паролем, и когда я вхожу, я получаю имя участника и у меня есть заголовок. Layout содержит изображение и текстовое представление под ним, называемое edit user. Мне нужно передать ему член имя, полученное из макета входа в систему, и это мой код
основная форма
макет XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinatorLayout1">
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linearLayout1">
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/drawerLayout1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:minWidth="25px"
android:minHeight="55px"
app:titleTextColor="#ffff"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:paddingVertical="15dp"
app:navigationIcon="@mipmap/menu"
android:background="@drawable/mygradient"
android:id="@+id/toolbar1" />
<include
layout="@layout/Include_Main"/>
</LinearLayout>
<android.support.design.widget.NavigationView
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/headerlayout"
app:menu="@menu/navmenu"
android:id="@+id/navigationView1" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
</RelativeLayout>
, тогда как форма заголовка содержит
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="200dp"
android:paddingTop="59dp"
android:background="@color/maindrawer">
<Refractored.Controls.CircleImageView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:src="@drawable/account"
android:scaleType="centerCrop"
android:layout_marginBottom="10sp"
android:id="@+id/circleImageView1" />
<TextView
android:text="username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center"
android:textSize="18sp"
android:textColor="#000"
android:layout_marginBottom="5dp"
android:id="@+id/edituser" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:id="@+id/view1"
android:background="@color/maindrawer"/>
</FrameLayout>
Мне нужно передать имя пользователя из логина, кликнуть на него
Intent intent = new Intent(this, typeof(headerlayout));
intent.PutExtra("MyData", "Emad Younan Amien");
StartActivity(intent);
Пожалуйста, помогите мне изменить текст имени пользователя на emad younan
и код, который я использую в headerlayout
username = FindViewById<TextView>(Resource.Id.edituser);
string usee = Intent.GetStringExtra("MyData") ?? "Data is not available";
username.Text = usee;
// Create your application here
Intent intent = new Intent(this, typeof(Main_Home));
intent.PutExtra("MyData", "Emad Younan Amien");
StartActivity(intent);
это изображение для того, что я имею в виду, изменить имя