zoukankan      html  css  js  c++  java
  • 跳转

    
    
    <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout 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=".MainActivity">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    
    </androidx.constraintlayout.widget.ConstraintLayout>
    
    
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
        <TextView
            android:id="@+id/textView2"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:background="#00BCD4"
            android:gravity="center"
            android:text="注册信息"
            android:textColor="#FF5722"
            android:textSize="25sp" />
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="25dp"
            android:gravity="center"
            android:orientation="vertical">
    
            <TextView
                android:id="@+id/textView3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="你的注册信息是:"
                android:textSize="20sp" />
    
            <TableLayout
                android:layout_width="match_parent"
                android:layout_height="400dp">
    
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">
    
                    <TextView
                        android:id="@+id/textView4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="用户名:"
                        android:textSize="20sp" />
    
                    <TextView
                        android:id="@+id/show_name"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                </TableRow>
    
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">
    
                    <TextView
                        android:id="@+id/textView9"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="密码:"
                        android:textSize="20sp" />
    
                    <TextView
                        android:id="@+id/show_pass"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                </TableRow>
    
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">
    
                    <TextView
                        android:id="@+id/textView11"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="性别:"
                        android:textSize="20sp" />
    
                    <TextView
                        android:id="@+id/show_gender"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                </TableRow>
    
                <TableRow
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">
    
                    <TextView
                        android:id="@+id/textView13"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="爱好:"
                        android:textSize="20sp" />
    
                    <TextView
                        android:id="@+id/show_hobby"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                </TableRow>
            </TableLayout>
        </LinearLayout>
    </LinearLayout>
    package com.example.myapplication;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    
    import org.w3c.dom.Text;
    
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.login);
        }
    
           public void login(View view){
               EditText id = (EditText) findViewById(R.id.edit1);
               String s = id.getText().toString();
               Intent intent=new Intent();
               intent.setClass(MainActivity.this, TestActivity.class);
               intent.putExtra("id",s);
               startActivity(intent);
           }
    
    }
    package com.example.myapplication;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.TextView;
    
    public class TestActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_test);
            TextView t = (TextView)findViewById(R.id.text);
            Intent intent = this.getIntent();
    
            String id = intent.getStringExtra("id");
            System.out.println(intent.getStringExtra("id"));
            t.setText(id);
        }
    }
  • 相关阅读:
    stm32入门
    Shell入门
    广播与组播
    超时接收
    socket的四种IO模型
    网络套接字socket
    网络基础
    慢速系统调用被中断
    C# 程序运行时间计算
    HTTP的传输编码(Transfer-Encoding:chunked) / net::ERR_INVALID_CHUNKED_ENCODING
  • 原文地址:https://www.cnblogs.com/qsf1975747------/p/13832046.html
Copyright © 2011-2022 走看看