<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity2">
<TextView
android:id="@+id/tv21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"
android:textSize="80px"
android:layout_marginTop="100dp"
android:layout_marginLeft="50dp"
/>
<TextView
android:id="@+id/tv22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码 :"
android:textSize="80px"
android:layout_below="@+id/tv21"
android:layout_marginLeft="50dp"
/>
<TextView
android:id="@+id/tv23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="性别 :"
android:textSize="80px"
android:layout_below="@+id/tv22"
android:layout_marginLeft="50dp"
/>
<TextView
android:id="@+id/tv24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="爱好 :"
android:textSize="80px"
android:layout_below="@+id/tv23"
android:layout_marginLeft="50dp"
/>
<TextView
android:id="@+id/tv221"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tv21"
android:layout_marginTop="100dp"
android:textSize="75px"
/>
<TextView
android:id="@+id/tv222"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tv22"
android:layout_below="@+id/tv221"
android:textSize="75px"
/>
<TextView
android:id="@+id/tv223"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tv22"
android:textSize="75px"
android:layout_below="@+id/tv222"
/>
<TextView
android:id="@+id/tv224"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv223"
android:layout_toRightOf="@id/tv23"
android:layout_marginTop="10dp"
android:textSize="75px"
/>
</RelativeLayout>
package com.example.activtiy;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity2 extends AppCompatActivity {
private TextView tv221,tv222,tv223,tv224;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
tv221 = (TextView)findViewById(R.id.tv221);
tv222 = (TextView)findViewById(R.id.tv222);
tv223 = (TextView)findViewById(R.id.tv223);
tv224 = (TextView)findViewById(R.id.tv224);
Intent intent = getIntent();
tv221.setText(intent.getStringExtra("name"));
tv222.setText(intent.getStringExtra("password"));
tv223.setText(intent.getStringExtra("sex"));
tv224.setText(intent.getStringExtra("ai"));
}
}